introduction to pic16f84a, pic16f84a pinout, pic16f84a features, pic16f84a applications, pic16f84a memory layout
Hi Friends! Hope you are doing well. We welcome you on board. Today, I'll highlight and explain the details on the Introduction to PIC16F84a. It is an 18-pin PIC microcontroller, introduced by Microchip Technology, that comes with serial programming algorithm. It contains one 8-bit timer and 13 I/O bidirectional pins. Microcontrollers have always been a great choice for experts since their inception long while ago. They are widely used for the embedded system, industrial automation, and robotics as they contain an onboard chip that requires no external components for making it work like an automatic system and reduces the space required for the development of the project. In this tutorial, I'll discuss each and everything related to PIC16F84a, so you don't have to wrestle your mind for browsing the internet and find all information in one place. Let's jump right in and nail down everything you need to know. Note:
  • Following is the link to download PIC16F84a datasheet, produced by Microchip.
  • Moreover, I have also shared the link of a reliable online source from where you can buy it easily.

[dt_default_button link="http://ww1.microchip.com/downloads/en/devicedoc/35007b.pdf" button_alignment="default" animation="fadeIn" size="medium" default_btn_bg_color="" bg_hover_color="" text_color="" text_hover_color="" icon="fa fa-chevron-circle-right" icon_align="left"]Download Datasheet[/dt_default_button]

Introduction to PIC16F84a

  • PIC16F84a is an 8-bit PIC Microcontroller that comes with enhanced EEPROM and is a successor of PIC16C84 that was introduced back in 1993 by Microchip Technology with the intention of making electronic tasks easy that require no or minimum skills to get the hands-on experience working with them.
  • PIC16F84a has an 8-bit timer and comes with an ability of serial programming interface that proves to be very handy for laying out serial communication with other devices.
  • It contains 64 bytes  EEPROM (mainly used for storing data), 1K program memory (indicates the capacity of code you can burn inside the controller), 68 bytes of data memory (RAM) and stays ahead of its predecessor in terms of compatibility and program security.
introduction to pic16f84a, pic16f84a pinout, pic16f84a features, pic16f84a block diagram, pic16f84a applications, pic16f84a memory layout
  • Clock speed around 20MHz is very handy to execute the instruction with greater pace.
  • Both PIC16F84a and PIC16C84 come with identical programming hardware and feature similar characteristics in one way or the other, however, programming software is different for both of them.
  • There are 13 I/O pins present on the PIC16F84a, that hold enough power to control LED but they don't seem feasible for controlling DC motors, and we require external PMIC (power management integrated circuits) for this purpose that can be easily configured and interfaced with the controller.

1. PIC16F84a Pinout with Description

You have got a brief overview of this PIC16F84a version. Now, we move to the next step and mention the pinout of the controller with detailed description of each pin.
PIC16F84a Pinout
Following figure shows the pinout of PIC16F84a
introduction to pic16f84a, pic16f84a pinout, pic16f84a features, pic16f84a applications, pic16f84a memory layout
  • The PIC16F84a comes with two packages called PDIP and SSOP and both contain 18 and 20 pins respectively.
  • SSOP contains extra ground and voltage supply pins.
PIC16F84a Pin Description
Pin #5. It is a ground pin labeled as Vss that is connected to a negative terminal of the 5V battery. Pin #14. It is the voltage supply pin of the controller that is connected to the positive terminal of the battery. Pin #4. A memory clear pin, labeled as MCLR. It is an active low pin - clears the RAM memory when this pin is kept low. Pin #15 & Pin #16. are used for connection with crystal oscillator which provides the required clock frequency for executing the number of instructions with greater pace. Maximum clock frequency it can sustain is 20MHz.  It comes with an ability to execute 20,000,000 instructions per second. I/O Pins. There are 13 I/O pins incorporated on the chip marked from 6 to 13 and 1,2,3,17&18. They are bidirectional pins and can be used either way i.e. input or as an output. There are two ports on the board named Port A and Port B where pins 17,18,1,2&3 fall under Port A and 6,7,8,9,10,11,12&13 fall under Port B which is software programmed for targeting internal weak pull-up on all inputs. Clock Input. Four Pins in the PORTA named as RA0 to RA4 are used for clock input to the timer0/counter where the output is an open drain type. In the following table, I have compiled the function of each pin
Pin# Pin Name Pin Description
17 RA0 I/O Bidirectional pin
18 RA1 I/O Bidirectional pin
1 RA2 I/O Bidirectional pin
2 RA3 I/O Bidirectional pin
3 RA4 Used for clock input to the timer0
4 MCLR This is a master clear low reset pin
15 OSC2/CLKOUT This pin is connected to a crystal oscillator and acts as a crystal oscillator output pin. In RC mode, this pin has a 1/4 frequency of OSC1
16 OSC1/CLKIIN This pin is connected to a crystal oscillator and acts as a crystal oscillator input pin
6 RB0 used as an external interrupt pin
7 RB1 All PORTB Pins are software programmed
8 RB2 I/O Bidirectional pin
9 RB3 I/O Bidirectional pin
10 RB4 Interrupt-on-change pin
11 RB5 Interrupt-on-change pin
12 RB6 Serial Programming Clock/Interrupt-on-change pin
13 RB7 Serial Programming Data/Interrupt-on-change pin
5 Vss Ground Pin
14 Vdd Voltage Supply Pin

2. PIC16F84a Features

In the previous section we highlight the basic functions of microcontroller pins. Now, we discuss the main features of PIC16F84a so you get a clear idea of what this chip is capable of doing before you make a final decision to install it in the relevant project. Following table shows the complete features of PIC16F84a.
PIC16F84a Features
No. of Pins 18
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
No. of I/O Pins 13
Program Memory 1K or 1024 words
RAM 68 Bytes
EEPROM 64 Bytes
Internal Oscillator NiL
External Oscillator 20 MHz
Timer 8-Bit Timer (1)
USART Protocol 1
I2C Protocol NiL
SPI Protocol NiL
No. of Special Function Registers 15
Watchdog Timer Yes
Power-on Reset Yes
Design Static
Segment LED No
Power Saving Sleep Mode Yes
Selectable Oscillator Option Yes
Maximum Current Drawn Each Pin 25mA
Data Retention Capability 40 Years
Oscillator Start-up Timer Yes

3. PIC16F84a Functions

This PIC model performs many functions that are quite similar to the function in other controllers of the PIC community. Following are the main functions of PIC16F84a.
Timer
PIC16F84a contains one 8-bit timer that can be used in both ways i.e. timer and counter. and comes with internal and external clock select capability. When the bit T0CS (OPTION_REG<5>) is cleared, the timer mode will be selected and when this bit is set, the counter mode will be selected. The timer mode increments the instruction cycle while counter mode will increment the rising and falling edge of the pin.
In-Circuit Serial Programming
PIC16F84a is widely used for in-circuit programming as it contains USART module. This module consists of Tx which is a transmission pin used for transmitting serial data to other devices and Rx is a receive pin used for receiving serial data.
Watchdog Timer
PIC16F84a comes with built-in timer called watchdog timer that can be configured with programming. This timer is mainly used to reset the controller when a program hangs up during compilation or gets stuck in infinite loop of the program. More or less, watchdog timer works like a countdown timer and starts from 1000 and gradually goes down to zero. It must be reset to initial value after every 3 instructions in order to avoid reaching it to zero value in normal conditions.
Sleep Mode
Power saving sleep mode is added in the chip that generates a low current power down mode. The sleep mode can be removed using an interrupt, watchdog timer or external reset.
Power On Reset
This feature is included in most of the PIC controllers that resets the controller when it is powered on. If there comes a glitch in the chip, powering on the device will exclude it from the loop of any malfunctioning in the device.

4. PIC Compiler

  • MPLAB C18 Compiler is mainly used for PIC microcontrollers which is a standard compiler introduced by Microchip.  You can download this compiler online from the Microchip Official Site.
  • Third party software are also used for compiling the program and MikroC Pro For PIC is readily available for this purpose.
  • You must check this list of Top 3 PIC C Compilers where you can choose any compiler based on your needs and requirements.
  • The code written in the compiler generates a hex file that is uploaded on the PIC Microcontroller.
  • You can use PICKit3, a standard PIC burner, for burning the code in the controller. There are other unofficial burners used for burning the code, however, PICKit3 is mostly preferred and stays ahead of other burners in terms of efficiency and performance.

5. PIC16F84a Memory Layout and Working

Registers play a vital role in the controller. They are the data holding places in the processor of the controller. A single register can hold storage address, instruction and any kind of data ranging from bit sequence to individual characters. Registers are divided into two types General Purpose Registers Special Function Registers Both are used for holding specific data. General purpose registers are used for storing any modified or random value in the processor. While Special function registers monitor and control the various aspect of the processor functions. Registers are divided into two banks known as Bank 1 and Bank 2 where registers ranging from 00H to 0BH and 80H to 8BH are SFRs and remaining are GPRs. Each bank comes with 128 bytes of memory space where first 12 locations are allocated to special function registers while remaining are reserved for general purpose registers that are used as static RAM.
introduction to pic16f84a, pic16f84a pinout, pic16f84a features, pic16f84a block diagram, pic16f84a applications, pic16f84a memory layout
Though we cannot write off the importance of GFRs, however, SFRs always stay ahead of GPR in terms of functionality. Let's discuss few registers in details so you can get a hold of what they are mainly used for. STATUS. This register is mainly used for switching between the banks. Setting fifth bit of this register indicates we targeting bank 1 while resetting it will indicate we are targeting bank 0. TRISA. This register decides the possibility if the Port A pins are used as input or output. The value 1 indicates output and value 0 indicates input. Suppose, Port A holds the value 0010, it represents RA0 and RA1 as an input and RA2 as an output, and similarly RA3 again as an input. TRISB. This register works similar to the TRISA and is mainly used to address the PORTB and decides its pins as an input or output. W Register. This register falls under the category of GPRs while all registers mentioned above are SFRs. It is accessible by a program and is not a part of any register bank. The desired values must be written on W register and moved to the target register before defining them for PORTA or TRISA.

6. PIC16F84a Block Diagram

Following figure shows the block diagram of PIC16F84a.
introduction to pic16f84a, pic16f84a pinout, pic16f84a features, pic16f84a block diagram, pic16f84a applications, pic16f84a memory layout
  • This model version falls under the family of mid-range microcontroller devices.
  • The program memory comes with 1K words of memory space which can configure 1024 instructions.
  • Some pins in the controller can be interfaced with other device functions including external interrupt, Timer0 clock input and Change on PORTB interrupt.

7. PIC16F84a Projects and Applications

  • This PIC version is mainly used in students project where automation is the main concern.
  • Central heating projects
  • Production of temperature data logger
  • Used in security systems
  • Gas sensor projects
  • Main part of the embedded system
  • Used in industrial automation
  • Setting up serial communication with other devices

8. Why Use PIC MicroControllers

Playing with circuits seems quite daunting for some people. They don't like to get involved in electronics with the illusion they need to be highly skilled and professional before working on electric circuits. Watching other people proceed and developing many projects with the same interest as yours put you in high inferiority complex. However, with the invention PIC controllers, and similar compact chips, things are not the same as they were a long while ago. PIC controllers are easy to configure and require no or minimum prior skills to get familiar with the complete working of the device. What makes them useful is their ease of use and economical price. You don't need a cluster of external components, as PIC circuits provide you everything in a single compact chip required for developing the electronic projects using minimum circuit layout. Timers, counters, serial communication interface, and so many identical functions can be performed using a single chip. That's all for today. I hope I have given you everything you needed to know about PIC16F84a. However, if you are feeling skeptical or have any question you can ask me in the comment section below. I'd love to assist you in any way I can. You are most welcome to give us your suggestions, they help us provide you quality work so you keep coming back for what we have to offer. Thanks for reading the article.