Program Execution The program consists of a sequence of 14-bit codes, which contain both the operation code and operand in a fixed length instruction. This machine code program is derived from a source code program created as a text file on a host PC, assembled and downloaded, as detailed in Chapter 4. At the moment […]
Continue reading…
Uncategorized
PIC Architecture
An overview of microcontroller (MCU) principles has been provided in Part 1. We now need to look at the PIC® internal hardware in more detail. We will use the 16F84A chip as a reference, despite its partial obsolescence, since it has all the essential elements found on all the current chips in the family without […]
Continue reading…
PIC Architecture:Block Diagram
Block Diagram A somewhat simplified internal architecture (Figure 5.1) has been derived from the block diagram given in the data sheet. Some features seen in the manufacturer’s diagram have been left out because they are not important at this stage. The functional blocks of the chip are shown, with the main address paths identified. The […]
Continue reading…
PIC Program Development:Program Testing
Program Testing Preliminary hardware inspection and testing is important if the circuit is newly constructed, and essential if it is a new design. First, have a good look at the board to check that the correct components have been fitted in the correct places and orientation, there are no dry joints or solder bridges and […]
Continue reading…
PIC Program Development:Program Downloading
Program Downloading After testing in the simulator for correct operation, the machine code program can be blown into the flash memory on the chip. The program is downloaded via a serial link into a specific pin, RB7 in the case of the 16F84A. There are two methods for program downloading, outlined below. Programming Unit The […]
Continue reading…
PIC Program Development:Program Simulation
Program Simulation The BIN4.HEX file could now be downloaded to the PIC chip and the program executed in hardware. It should run correctly because the program given here is known to be good. However, when a program is first developed, it is quite likely that logical errors will be present. This means that the program […]
Continue reading…
PIC Program Development:Program Assembly
Program Assembly To create the PIC program, the MPLAB IDE development system must be downloaded and installed from the Microchip website www.microchip.com. After starting the software, clicking on the new file button opens a source code edit window. The code for the demo programs can be entered and saved in a suitable folder, using the […]
Continue reading…
PIC Program Development:Program Analysis
Program Analysis The program BIN4 will now be analyzed in some detail as it was designed to contain examples of common PIC syntax. A sample instruction of each type will be examined. The use of labels in place of numbers makes programs easier to write and understand, but we have to ‘declare’ those labels at […]
Continue reading…
PIC Program Development:Program Structure
Program Structure Structured programming means constructing the program, as far as possible, from discrete blocks. This makes the program easier to write and understand, more reliable and easier to modify at a later date. Program BIN3 is unstructured, in that the program instructions are essentially executed in the order given in the source code. An […]
Continue reading…
PIC Program Development:Program Editing
Program Editing The program is written using the instruction set of the processor selected, as specified in the MCU data sheet. The instruction set is essentially the same for all 16 series PIC chips. The source code, that is, the assembly code program, must be entered into a suitable text editor, which is normally provided […]
Continue reading…