Basic Features of PIC16F84 Microcontroller

PIC is a short form for peripheral interface controller; this phrase is used by Microchip to refer to its line of microcontrollers. Microchip delivers a large and varied family of inexpensive PIC microcontrollers. They do vary in physical size, the number of I/O pins available, the size of the EEPROM and RAM space for storing programs and data and the availability of analog to digital (A/D) and digital to analog converters (D/A). The more features and capacity a microcontroller has, the higher the cost. PIC16F84 is one of the low cost and easy to program microcontroller offered by Microchip. Building a good understanding of this particular microcontroller can help you extend that knowledge to other microcontrollers with different features and programming options.

PIC16F84 is an 8-bit microcontroller that has EEPROM flash memory for program and data storage and supports 13 digital I/O lines. Additionally, this particular microcontroller has no inbuilt serial communication capability or A/D or D/A converters.

PIC microcontrollers use Harvard architecture, which simply means that the memory of the PIC microcontrollers is divided into program memory and data memory. The devices also use separate buses to communicate with each memory type. The Harvard architecture has an improved bandwidth in comparison to traditional computers that use the von Neumann architecture [von Neumann architecture accesses data and memory over the same bus]. The Harvard architecture allows for other enhancements, for instance, instructions may be sized differently than 8-bit wide data.

The RAM, in addition to providing space for storing data, maintains a set of special purpose byte-wide locations called file registers. The bits in these registers are used to control the function and indicate the status of the microcontroller. 

The data memory in PIC microcontroller can be further broken down into general purpose RAM and the special function registers (SFRs). The registers on the PIC 16F84 are mapped in the data memory section at specific addresses.

The CPU in the PIC16F84 uses an 8-bit data bus (pathway). The registers on the PIC chip are also 8 bits wide. Thus, a byte is the perfect size to access the PIC chip registers.

A watch-dog timer, which is included on PIC microcontrollers, is a count-down timer that, when activated, needs to be continually reset by the running program. If the program fails to reset the watch-dog timer before it counts down to 0, the PIC will automatically reset itself. In a critical application, this feature might be used to have the microcontroller reset if the software gets caught in an unintentional endless loop.

The PIC16F84 contains two I/O ports, PORTA and PORTB. Each port has two registers associated with it, the TRIS (Tri State) register and the port register address itself. The TRIS register controls whether a specific pin on a port is configured as an input line or as an output line. Once the ports are configured the user may then read or write information to the port using the port register address.

The PIC16F84 is typically packaged on an 18-pin DIP IC that has the pin schematic as illustrated below:

The figure above shows the minimum set of external components that are recommended for the PIC to function properly.

The 5 pins RA0 through RA4 are digital I/O pins collectively called PORTA, and the 8 pins RB0 through RB7 are digital I/O pins collectively termed to as PORTB. . In total they are 13 I/O lines, called bidirectional lines because each can be individually configured in software as an input or output.

PORTA and PORTB are actually special purpose file registers on the PIC that provide the interface to the I/O pins. Even though all PIC registers contain 8 bits, only the 5 least significant bits (LSBs) of PORTA are utilized.

The TRIS register is a 1-byte (8-bit) programmable register on the PIC16F84 that controls whether a particular I/O pin is configured as an input or an output pin. There is a TRIS register for each port. TRISA controls the I/O status for the pins on PORTA and TRISB controls I/O status for the pins on port B. If you place a binary 0 at a bit location in TRISB for PORTB, the corresponding pin location on PORTB will become an output pin. If you place a binary 1 at a bit location in the TRISB, the corresponding pin on PORTB will become an input pin.

The master clear pin (MCLR) is active low and provides a reset feature. Grounding this pin causes the PIC to reset and restart the program stored in the EEPROM. This pin must be held high during the normal program execution. This is achieved with the pull-up resistor shown in Fig 1.0. If this pin were left unconnected (floating), the chip might reset itself sporadically.

The PIC clock frequency can be controlled using different techniques, including an external RC circuit, an external clock source, or a clock crystal. In Fig 1.0, the clock frequency is set by connecting a 4-MHz crystal across the OSCI and OSC2 pins with 22 pF capacitors grounded.

The power and ground are connected to the PIC through pins Vdd and Vss. The dd and ss subscripts refer to the drain and source notation used for MOS transistors (PIC is a CMOS device).

Another key feature of the PIC, which is also available on most of other microcontrollers, is its ability to process interrupts. An interrupt usually occurs when a specially designated input changes state. When this happens, normal program execution is suspended while a special interrupt handling part of the program is executed.

Please follow us and share:

Author: John Mulindi

John Mulindi has a background in a technical field and he writes on topics ranging from automation, computer systems, embedded systems, mechatronics to measurement and control.

2 thoughts on “Basic Features of PIC16F84 Microcontroller”

Leave a Reply