Introduction to PIC16F877

Hey Guys! Hope you are doing well. I am back to give you valuable information as per your technical needs and requirements. Today, I’ll unlock the detailed Introduction to PIC16F877. It is an 8-bit PIC microcontroller that comes with 40-pin interface (PDIP). It is based on Flash type memory. The High-Performance RISC CPU is incorporated inside the device that comes with only 35 single-word instructions, targeting mainly two types of instructions: single cycle and double-cycle. In this post, I'll cover each and everything related to PIC16F877: its features, pinout and pin description, main functions, memory interface, compiler and burner used and applications. Let's dive right in and get down to the nitty-gritty of this tiny device.

Introduction to PIC16F877

  • PIC16F877 is an 8-bit PIC microcontroller that is introduced by Microchip and is mainly used in automation and embedded systems.
It comes in three packages known as PDIP, PLCC, and QFN where the first one is 40-pin while other two come with a 44-pin interface.
  • It features 256 bytes of EEPROM data memory, 368 bytes of RAM, and program memory of 14K.
This microcontroller version incorporates CPU, timers, 10-Bit ADC and other peripherals that are mainly used to develop a connection with external devices.
  • The decent memory endurance around 1,000,000 for EEPROM and 100,000 for program memory, makes this device an ideal choice for many real-time applications.
The Universal Synchronous Asynchronous Receiver Transmitter (USART) is very helpful for developing serial communication with other devices.
  • Some internal and external reset features are added in the device that prevents the device from going stale, giving you a full authority to modify the controller as per your needs and requirements.
If automation is anything to go by, you cannot write off the importance of this little toy.

1. PIC16F877 Features

You have got a brief overview of the device. In this section, I have arranged the main features in a single table, making it easy for you to grab the main idea about the device. Let's have a look at the table.
CPU PIC
CPU Size 8-Bit
Total Number of Pins 40
I/O Pins 33
Analog Input 6
Flash Memory (Program Memory) 14 KB
SRAM 368 Bytes
EEPROM 256 Bytes
Timers (3) Timer0 Timer1 Timer2
Operating Voltage 4 to 5.5 V
Oscillator (Speed) up to 20 MHz
Manufacturer Microchip
Number of Ports (5) PORTA PORTB PORTC PORTD PORTE
Instruction Set 35 instructions
Capture/Compare/PWM Modules 2
Interrupts 14
A/D Converter 10-bit, 8 Channel
BOD (Brown Out Detection) Yes
Watch Dog Timer Yes
UART (Serial Communication) Yes
SPI Protocol Yes
I2C Protocol Yes
ICSP (In Circuit Serial Programming) Yes
DC Current for 3.3V Pin 50 mA
  • These features will help you understand the main characteristics of the controller and guide you in making a final decision before you intend to incorporate this chip into a certain project.

2. PIC16F877 Pinout and Description

In this section, we cover the pinout of the controller and a detailed description of each pin.
PIC16F877 Pinout
Following figure shows the pinout of PIC16F877.
  • This module comes in three packages known as  PDIP, PLCC, and QFP. The first one is mainly used for developing individual projects while other two are widely used in industrial applications.
PIC16F877 Pin Description
Following table shows the pin description of each pin. Some pins are capable to perform more than one function.
Pin# Pin Name Pin Description
1 MCLR' VPP Master Clear Active Low Reset Pin ICSP Programming Enable Pin
2 RA0 AN0 Digital I/O Pin Analog Input 0 Pin
3 RA1 AN1 Digital I/O Pin Analog Input 1 Pin
4 RA2 AN2 VREF- Digital I/O Pin Analog Input 2 Pin ADC Reference Input Voltage (low)
5 RA3 AN3 VREF+ Digital I/O Pin Analog Input 3 Pin ADC Reference Input Voltage (high)
6 RA4 T0CKI Digital I/O Pin External clock input for Timer0
7 RA5 AN4 SS' Digital I/O Pin Analog Input 4 Pin Slave Select input for SPI
8 RE0 AN5 RD' Digital I/O Pin Analog Input 5 Pin Read control for the parallel slave
9 RE1 AN6 WR' Digital I/O Pin Analog Input 6 Pin Write control for the parallel slave
10 RE2 AN7 CS' Digital I/O Pin Analog Input 7 Pin Select control for the parallel slave
11 VDD Voltage Supply Pin
12 VSS Ground Pin
13 OSC1 CLKIN Crystal Oscillator Input Pin
14 OSC2 CLKOUT Crystal Oscillator Output Pin
15 RC0 T1OSO T1CKI Digital I/O Pin Oscillator output for Timer1 External clock input for Timer1
16 RC1 T1OSI CCP2 Digital I/O Pin Oscillator input for Timer1 Output for Compare2 and PWM2, Input for Capture2
17 RC2 CCP1 Digital I/O Pin Output for Compare1 and PWM1, Input for Capture1
18 RC3 SCK SCL Digital I/O Pin SPI Module Synchronous serial clock input/output I2C Module Synchronous serial clock input/output
19 RD0 PSP0 Digital I/O Pin Parallel Slave Port for D0 with TTL input buffers
20 RD1 PSP1 Digital I/O Pin Parallel Slave Port for D1 with TTL input buffers
21 RD2 PSP2 Digital I/O Pin Parallel Slave Port for D2 with TTL input buffers
22 RD3 PSP3 Digital I/O Pin Parallel Slave Port for D3 with TTL input buffers
23 RC4 SDI SDA Digital I/O Pin SPI Data-In Pin I2C Data I/O Pin
24 RC5 SDO Digital I/O Pin SPI Data-Out Pin
25 RC6 TX CK Digital I/O Pin Asynchronous Transmit (USART) Synchronous Clock (USART)
26 RC7 RX DT Digital I/O Pin Asynchronous Receive (USART) Synchronous Data (USART)
27 RD4 PSP4 Digital I/O Pin Parallel Slave Port for D4 with TTL input buffers
28 RD5 PSP5 Digital I/O Pin Parallel Slave Port for D5 with TTL input buffers
29 RD6 PSP6 Digital I/O Pin Parallel Slave Port for D6 with TTL input buffers
30 RD7 PSP7 Digital I/O Pin Parallel Slave Port for D7 with TTL input buffers
31 VSS Ground Pin
32 VDD Voltage Supply Pin
33 RB0 INT Digital I/O Pin External Interrupt 0
34 RB1 Digital I/O
35 RB2 Digital I/O
36 RB3 PGM Digital I/O ICSP programming enable pin (Low voltage)
37 RB4 Digital I/O
38 RB5 Digital I/O
39 RB6 PGC Digital I/O ICSP programming clock, In-circuit debugger
40 RB7 PGD Digital I/O ICSP programming data, In-circuit debugger

3. PIC16F877 Main Functions

This PIC model is capable to perform many functions similar to other controllers in the PIC family. Following are the main functions of PIC16F877.
Timer
PIC16F877 comes with three timers known as Timer0 (8-bit), Timer1(16-bit) and Timer2 (8-bit). These timers can be used as a timer as well as a counter.
  • The timer mode is mainly used to increment the instruction cycle while the counter mode plays a vital role to increment the rising and falling edge of the pin.
All three timers contain internal and external clock select capability.
USART
PIC16F877 incorporates a USART (Universal Synchronous and Asynchronous Receiver and Transmitter) module that is mainly used to establish the serial communication with external devices.
Watchdog Timer
PIC16F877 comes with a built-in watchdog timer that takes the controller back to reset position if the program hangs up during compilation or gets stuck in the infinite loop.
  • It is nothing but a hardware timer that produces a system reset if the main program fails to periodically service it.
It is advised to reset this timer to the initial value after every 3 instructions in order to avoid it going to zero value in normal conditions.
  • The Watchdog Timer can be controlled only through configuration bits. It comes with its own RC oscillator for maximum reliability.
Brown Out Reset (BOR)
The BOR function is a very remarkable addition that puts the device in reset condition once the Vdd (voltage supply) drops below a brownout threshold voltage.
  • If the Power Up Timer is kept enabled, it will create the delay for returning the device from a BOR function. The BOR mode can be configured both ways: BOREN settings in a register or using programming.
The multiple voltage ranges are provided to secure the chip if the power drops at the voltage supply line.
In-Circuit Serial Programming
In-circuit serial programming (ICSP), also called In-system programming (ISP), is a function that allows the chip to be programmed in the required project after installation, setting you free from plugging and unplugging the device in the project over and over again.
Master Clear Reset (MCLR)
The MCLR pin serves as an external reset for the chip. This pin is independent of the internal resets and is activated by keeping this pin at a LOW value.
  • The MCLRE configuration bit is mainly used to disable MCLR input and the noise filter is included in the MCLR executing process that allows to detect and remove the small pulses.
Power On Reset
Power On Reset function is a very useful function that resets the controller and prevents it from malfunctioning. When the module is powered on, the power-on reset will start the module from scratch once the Vdd raises above a certain threshold value.
  • The Power Control (PCON) Register comes with flag bits that help to differentiate between a Power-on Reset (POR), a Watchdog Reset(WDT) and external MCLR Reset.
SPI Communication

Serial Peripheral Interface (SPI) is a remarkable function of the chip that is commonly used to send data between microcontrollers and small peripherals such as sensors, shift registers, and SD cards.

  • It comes with separate clock and data lines, layered with a select line to choose the device for communication.
I2C Communication
The I2C is a two-wire interface communication that comes with two main lines known as SDA and SCL where former is s serial data line that carries the data and later is serial clock line that is used to synchronize all data transfers over the I2C bus.

4. PIC Compiler

  • PIC compilers and burners are used for different purpose. The former is a software used to write the desired code for the module while later is used to transfer and burn the code on the module.
There are various compilers used for the PIC controller and MPLAB C18 Compiler is an official compiler main developed for the PIC modules. You can get this compiler online from the Official Microchip Site.
  •  MikroC Pro For PIC is a third party software and is a good replacement for PIC standard compiler.
  • These Top 3 PIC C Compilers give you the flexibility to choose from and pick any compiler as per your needs and demands.
The code written in the compiler generates a hex file which is then transferred to the microcontroller using a burner.
  • The PICKit3 is a standard PIC burner for PIC controllers. Other burners are also available in the market but PICKit3 is mostly preferred for the PIC controllers.

5. PIC16F877 Memory Layout and Working

Memory, as the word suggests, is used to store a number of instructions inside the controller. It is mainly divided into three major types: Program Memory (Flash Memory) Data EEPROM Data RAM Let’s get down to the main features of each memory.
Program Memory
The Program memory, also known as ROM memory or Flash memory, stores the number of instructions permanently.
  • It comes with a memory space around 14K and is independent of the power supply i.e. have the ability to store information in the absence of main power supply.
Data EEPROM
The EEPROM Data Memory is similar to ROM memory with one exception i.e. the instructions in EEPROM can be controlled and modified during the controller operation.
  • The EEPROM incorporates memory space around 256 bytes and is mainly addressed by multiple control registers.
Data RAM
RAM memory, also known as volatile memory, stores the program temporarily and is dependent on the power supply. It comes with a memory space around 368 bytes  and is mainly classified into two main parts called General-purpose registers (GPR) Special-function registers (SFR)
  • These registers are spread across the multiple banks and are the data holding places that can hold instruction, storage address, and any kind of data ranging from an individual character to bit sequence.
General purpose registers are implemented as a static RAM and can be easily accessed by File Select Register. They store any modified or random value in the processor and are located on the upper side of banks.
  • On the other hand, Special function registers are located on the lower side of the banks and are used to control the peripheral functions, covering the first 32 locations of each bank.
When reduction and decent code execution is required, some Special Function Registers from one bank are mirrored and placed in another bank.

6. PIC16F877 Block Diagram

The following figure shows the block diagram of PIC16F877.
  • PIC16F877 comes with five ports where each port contains 8 pins except the E port that comes with 3 pins.
  • It is important to note that higher order bits are related to the STATUS register

7. PIC16F877 Projects and Applications

PIC16F877 comes with a variety of applications with the main aim to drive automation in the relevant project. Following are some major applications it can be used for.
  • Student projects for motor controlling and sensor interfacing
  • Health and security systems
  • Central heating projects
  • Embedded system
  • Gas sensor projects
  • GPS projects
  • Serial Communication
  • It is widely used in home and industrial automation
  • Production of temperature data logger

8. Why Use PIC MicroControllers

  • Earlier, if you were aiming to design the automation project, you'd need a bunch of wires and a plethora of electrical components, that would not only cost you more but making your project heavy with more space requirement. These PIC controllers prove to be a lifesaver for your technical needs requiring minimum circuitry.
  • These controllers come with a user-friendly interface and easy onboard architecture that requires little or no prior skills before getting familiar with the chip.
  • PIC controllers have a leg over other Atmel controller like 8051 due to their higher processing speed and efficiency.
  • They are very handy in terms of consuming minimum power consumption that makes this controller an ideal choice for the projects where power limitation is a major concern.
That’s all for now. I hope I have given you everything you needed to know about PIC16F877. If you are unsure about anything you consider I have left unsaid about this chip, 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 keep us updated with your valuable suggestions, we plan our content strategy based on them, so keep them coming. Thanks for reading the article.

Introduction to PIC12F683

Hey Fellas! Hope you are doing well. Today, I'll uncover the details on the Introduction to PIC12F683. It is an 8-bit PIC microcontroller that contains eight pins and is mainly used for real-time applications related to automation and embedded system. If you are a newbie or an expert, you need PIC controllers every now and then for the development of electronic projects. These controllers help you drive automation in your projects with the ability to perform a number of functions on a single chip. In this tutorial, I'll discuss each and everything related to PIC12F683 so you don't have to grapple your mind surfing the whole internet and find all information in one place. Let's dive in and break down everything you need to know.

Introduction to PIC12F683

  • PIC12F683 is an 8-bit PIC microcontroller that comes with 8-pin interface. It falls under the category of CMOS controllers and comes with nanoWatt technology.
  • The architecture is based on Flash but controller lacks some functions like USART, SPI, and I2C module, however, features like In-Circuit Serial Programming, Watchdog timer, and Oscillator start-up timer make this device an ideal choice for some real-time applications.
  • Memory space is less than other 40-pin controllers in the PIC community but is enough to configure automatic functions in the electronic projects.
  • Program memory comes with 3.5KB memory space, and RAM and EEPROM memories are 128bytes and 256 bytes respectively.
  • Though this module lacks some major functions, we can't wipe off its value in terms of converting analog signals to digitals ones. This device comes with 10-bit ADC converter that is a remarkable addition in a tiny device like this and is very helpful for sensor interfacing.
  • Power-up timer, Master Clear Reset, and Sleep Mode are some useful features that work both ways i.e. taking the device out of the infinite loop by restarting it and saving power where power management is a major concern.
  • With that being said, if your project requires more functions to be carried out on a single chip with more pins and memory interface, it is preferred to use PIC18F4520.

PIC12F683 Features

Features of any device are very important to get the main idea about the device before installing it in the relevant project. Following table shows the complete features of PIC12F683.
PIC12F683 Features
No. of Pins 8
CPU RISC 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 3.5K
Program Memory Type Flash
RAM 128 Bytes
EEPROM 256 Bytes
ADC Number of ADC Channels 10-Bit 4
Comparator 1
In-circuit serial programming Yes
Oscillator up to 20 MHz
Timer (3) 16-Bit Timer (1) 8-Bit Timer (2)
Oscillator Start-up Timer Yes
Power Up Timer Yes
I/O Pins 6
Manufacturer Microchip
SPI No
I2C No
Watchdog Timer Yes
Brown out Reset (BOR) Yes
Master Clear Reset Yes
Interrupt-on-Pin Change Yes
Minimum Operating Temperature -40 C
Maximum Operating Temperature 125 C
 

PIC12F683 Pinout and Description

You have got a complete overview of the features of this module. In this section, we cover pinout and pin description of the chip.
Pinout
The following figure shows the pinout of PIC12F683.
  • This PIC module comes in three packages named PDIP, DFN and DFN-S and all three packages contain 8-pin on each module.
Pin Description
Following table shows the pin description of each pin that highlights the major functions associated with each pin.
Pin# Pin Name Pin Description
7 GP0 AN0 CIN+ ICSPDAT I/O Bidirectional pin Analog pin channel 0 Comparator In-Circuit Serial Programming
6 GP1 AN1 CIN- VREF ICSPCLK I/O Bidirectional pin Analog pin channel 1 Comparator External Voltage Reference In-Circuit Serial Programming Clock
5 GP2 AN2 T0CKI INT COUT I/O Bidirectional pin Analog pin channel 2 Timer Interrupt Comparator
4 GP3 MCLR VPP I/O Bidirectional pin Master Clear Reset Programming Voltage Input
3 GP4 AN3 T1G OSC2 CLKOUT I/O Bidirectional pin Analog pin channel 3 Timer Oscillator Output Comparator
2 GP5 T1CKI OSC1 CLKIN I/O Bidirectional pin Timer Oscillator Input RC oscillator connection
1 VDD Voltage Supply Pin
8 VSS Ground Pin

3. PIC12F683 Main Functions

As I already mentioned, this PIC module is not like some other fancy modules in the market, but some common functions make this device suitable for electronic projects. Let's discuss some major functions of this device.
Timers
There are three timers incorporated in the device where two are 8-bit and one is 16-bit timer. All these timers work both ways i.e. timer as well as the counter. Timer mode is used to create a delay in the execution of relevant functions and increments the instruction cycle. While the counter mode is used to count the number of intervals in the specific functions and increments the rising and falling edge of the pin. There are some other timers that are separated from mentioned timers and work in the same way to create a delay in the running function of the controller. These timers include
  • Oscillator Start-up Timer
  • Power-up Timer
The former is used to create the delay in the oscillator mode until the crystal oscillator becomes stable, while later is used to create the delay of 72ms once the device is powered on. This will give enough time and stabilize the power supply to provide power signals at regular intervals.
Watchdog Timer
The watchdog timer is a remarkable addition in the device that resets the device and puts it in a stable condition if running program hangs up or gets stuck in an infinite loop. When you are playing with the electronic device, it is very difficult to handle and reset the device manually, this is where watchdog timer comes handy and prevents the device from any malfunctioning.
Sleep Mode
Power saving sleep mode is very helpful for saving power that generates a low current power down mode. The sleep mode can be removed using an interrupt, external reset or watchdog timer.
In-Circuit Serial Programming
In-Circuit Serial Programming is another valuable feature added to the device that gives the option to program the controller after its installation in the relevant project, setting you free from separately testing the compiled program every time.
ADC Converter
What this module lacks in terms of USART, SPI, and I2C communications, it covers up for incorporating remarkable ADC converter into the device which makes it an ideal choice for sensor interfacing and for the applications that require analog to digital conversion. The ADC module is 10-bit and comes with 4-analog channels which are quite less than channels available in other controllers that normally contain 7 or 12 analog channels.
Master Clear Reset (MCLR)
The MCLR pin calls the external reset for the chip that is triggered by keeping this pin LOW. The noise filter is incorporated in the MCLR running process that detects and removes the small pulses. The MCLRE configuration bit is normally used to disable MCLR input.

4. PIC Compiler and Burner

  • Both, PIC compiler and burner are different things. Former is used to write the required program for the controller while later is used to transfer and burn the written program to the controller.
  • MPLAB C18 Compiler is a standard compiler for PIC controllers that is introduced by Microchip. This compiler is readily available on the Microchip site.
  • Third-party software can also be used for compiling the program and you must check this list of Top 3 PIC C Compilers where you can pick any compiler based on your technical requirements, however, MikroC Pro For PIC is a major replacement for standard PIC compiler.
  • It is important to note that the code we write on the compiler generates the hex which is then moved to the controller for carrying out required operation.
  • PICKit3 is a standard burner used for PIC controllers. There are other burners available in the market but PICKit3 is mostly used and preferred over other burners in terms of performance and efficiency.

PIC12F683 Memory Layout and Working

Memory, as the word defines, is used to store a number of instructions in the form of code. Memory is mainly divided into two major types Program Memory  Data Memory The former is used to store the instructions permanently and, more often than not, is known as ROM or Non-Volatile memory. This memory is not dependent on the power supply and comes with an ability to store the information in the absence of power supply.
  • Program memory comes with a memory space around 3.5K and contains 13-bit program counter that can address 8k x 14 memory space where reset vector lies at 0000h and interrupt vector stays at 0004h.
EEPROM also falls under Program memory and comes with 256 bytes of memory space and is similar to ROM in one way or the other where it stores information permanently but comes with one exception i.e. the EEPROM instructions can be controlled and modified during the controller operation. The data memory is known as RAM or volatile memory and stores information temporarily i.e. it depends on the power supply and all stored information is gone with the removal of a power supply.
  • Registers are the data holding places in the controller and can hold storage address, instruction and any kind of data ranging bit sequence or individual characters.
The data memory, implemented as static RAM, is divided into two banks which further contain two types of registers called General Purpose Registers Special Function Registers General purpose registers store any modified or random value in the processor, and are accessed by File Select Register. While Special function registers mainly control the peripheral functions and cover first 32 locations of each bank.
  • General Purpose Registers reserve 20h-7Fh in Bank 0 and A0h-BFh in Bank 1 and are implemented as static RAM while remaining RAM remains unimplemented and returns zero when read.
W Register. The W register falls under GPRs and is accessible by a program. It is important to note that, this register doesn’t take part in any register bank where required values must be written on it and moved to the target register before defining them for available pins.

6. PIC12F683 Block Diagram

Until now, you have got a clear idea about main features, pinout, pin description, and compiler used for this PIC module. In this section, we will discuss the block diagram of this tiny chip. Following figure shows the block diagram of PIC12F683. There is no PORT marked on this module, instead, pins are labeled as GP0 to GP5 where VDD and VSS are voltage supply and ground pins respectively. This PIC version falls under the category of Microchip's Low Pin Count Patent.

7. PIC12F683 Projects and Applications

  • Used in Industrial automation
  • Embedded and control systems
  • Sensor interfacing and motor control
  • Widely used in student projects for driving automation

8. Why Choose PIC Microcontrollers

PIC modules take the whole automation industry by storm with the ability to perform a number of functions on a single tiny chip. These modules stay ahead of other processors in terms of efficiency and the pace with which they can perform and execute a number of instructions. Everything is added in the small onboard chip including timers, counters, in-circuit serial programming, ADC converter and the main features required to embed automation in the electronic projects. You name it, they have it. If you intend to develop any project, the economic price is a major concern. These chips are highly economical and are readily available in the market. Compact and concise circuitry added on the boards make these devices lightweight which cover less space and prevent you from spending loads of money for buying external components. That’s all for today. I hope I have given you everything you needed to know about PIC12F683. If you are unsure or have any question, you can approach me in the comment section below. I’ll try my best to help you according to the best of my expertise. Keep us updated with your valuable feedback and suggestions, as they help us provide quality content as per your needs and demands. Thanks for reading the article.

Introduction to PIC12F675

Hey Guys! Hope you are doing well. I am back with one more piece of nugget with valuable information. Today, I'll unlock the details on the Introduction to PIC12F675.  It is an 8-bit CMOS PIC microcontroller, developed by Microchip and is based on FLASH. It comes with an 8-pin interface which is quite less than regular PIC controllers used in electronic projects that mostly come in a 20-pin or 40-pin interface and encompass more memory space with the ability to perform a number of functions on a single tiny chip.

In this post, I'll cover each and everything related to this controller including its main features, pinout, pin description, block diagram, and applications. Let's jump right in and nail down everything you need to know.

Introduction to PIC12F675

  • PIC12F675 is an 8-pin and 8-bit PIC microcontroller, developed by Microchip with the intention of developing automation and embedded projects.
  • Though it comes with a high-performance RISC CPU with interrupt capability, it is not like some other fancy controllers in the PIC community as it lacks a USART module and memory space is quite less as compared to other controllers.
  • SPI and I2C communications are not available on the board, but some features like watchdog timer, power-on reset, power on sleep mode and brownout detect (BOD) make this device an ideal choice for some electronic applications.
  • Program memory is 1.7KB, enough to store a number of instructions for driving automation, while RAM and EEPROM are 64 and 128 bytes respectively.
  • Additionally, the ADC module is added to the device which converts analog signals to digital ones and is mainly used for sensor interfacing and comes with only 4 operating channels.
  • Two timers are available onboard where one is an 8-bit timer while the other is a 16-bit timer.
  • Only one comparator is incorporated in the module that is mainly used to compare between the two signals where comparator output is externally accessible.
  • The 8-bit interface makes it fall under the category of Microchip's Low Pin Count Patent.
  • Other valuable functions include ICSP (in-circuit serial programming), programmable code protection, interrupt-on-pin change, power-up timer, Master clear reset and wide industrial and extended temperature range.

PIC12F675 Features

  • There are many valuable features added to the device that make it unique in terms of ease of use and innovation.
  • The following table shows the full features of PIC12F675:
PIC12F675 Features
No. of Pins 8
CPU RISC 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 1.7K
Program Memory Type Flash
RAM 64 Bytes
EEPROM 128 Bytes
ADC Number of ADC Channels 10-Bit 4
Comparator 1
In-circuit serial programming Yes
Oscillator up to 20 MHz
Timer (2) 16-Bit Timer (1) 8-Bit Timer (1)
Oscillator Start-up Timer Yes
Power Up Timer Yes
I/O Pins 6
Manufacturer Microchip
SPI No
I2C No
Watchdog Timer Yes
Brown out detect (BOD) Yes
Master Clear Reset Yes
Interrupt-on-pin Change Yes
Minimum Operating Temperature -40 C
Maximum Operating Temperature 125 C

PIC12F675 Pinout and Description

You have got a hold of the main features of PIC12F675. In this section, we cover the pinout and description of each pin.

PIC12F675 Pinout

  • The following figure shows the pinout of PIC12F675:
  • The VDD and VSS are voltage supply and ground pins respectively. Pin 4 is a master clear reset pin used to reset the controller.
  • While pin 2 & 3 are connected to a crystal oscillator that creates clock pulses in the controller.

Pin Description

  • The following table shows the table of pin description of each pin of PIC12F675, so you can get a hold of the main functions associated with each pin.
Pin# Pin Name Pin Description
7 GP0 AN0 CIN+ ICSPDAT I/O Bidirectional pin Analog pin channel 0 Comparator In-Circuit Serial Programming
6 GP1 AN1 CIN- VREF ICSPCLK I/O Bidirectional pin Analog pin channel 1 Comparator External Voltage Reference In-Circuit Serial Programming Clock
5 GP2 AN2 T0CKI INT COUT I/O Bidirectional pin Analog pin channel 2 Timer Interrupt Comparator
4 GP3 MCLR VPP I/O Bidirectional pin Master Clear Reset Programming Voltage Input
3 GP4 AN3 T1G OSC2 CLKOUT I/O Bidirectional pin Analog pin channel 3 Timer Oscillator Output Comparator
2 GP5 T1CKI OSC1 CLKIN I/O Bidirectional pin Timer Oscillator Input RC oscillator connection
1 VDD Voltage Supply Pin
8 VSS Ground Pin

PIC12F675 Functions

  • This PIC model can perform many functions, if not all, similar to other controllers in the PIC community.
  • Following are the main functions of PIC12F675.

Timer

  • PIC12F675 comes with two timers where one is 16-bit and the other is an 8-bit timer.
  • Both can be used as a timer as well as a counter.
  • The timer mode is used to create the delay in any running function that increments the instruction cycle while the counter mode counts the number of intervals in any function and is used to increment the rising and falling edge of the pin.
    • Oscillator Start-up Timers
    • Power Up Timer

The oscillator start-up timer is a very valuable feature that keeps the module in the reset mode until the crystal oscillator becomes stable. Similarly, a power-up timer is added that generates a delay of 72ms when you power on the device, which gives a proper time to the power supply to stabilize and provide power signals in a continuous manner.

Brown Out Detect (BOD)

  • The BOD, also known as BOR (Brown Out Reset), is a very useful function that resets the module once the Vdd (voltage supply) drops below a brownout threshold voltage.
  • Sometimes it is very difficult to manually reset the controller if there comes a malfunctioning in the controller, this is where BOD comes into play.
  • In this mode, multiple voltage ranges are provided to protect the module once the power drops at the voltage supply line.

It is important to note, the Power Up Timer should be enabled, in order to generate the delay in returning the device from a BOD function. BOD comes with four operating modes that can be programmed by setting or clearing BOREN bits.

  • BOD always on
  • BOD is controlled by software
  • BOD is off when in Sleep mode
  • BOD is always off

In-Circuit Serial Programming

Some devices can only be programmed before their installation in the project. This PIC model is an exception that comes with In-circuit serial programming (ICSP), also known as In-system programming (ISP), that helps in programming the module after its installation in the particular project. If you program the module before installation, you need to check and test the program every time its installation in the project.

In-Circuit Serial Programming gives you the flexibility to check the compiled program in the project so you can easily make the required changes and makes it compatible with the running application. 

Master Clear Reset (MCLR)

  • The MCLR, which is pin 4 in this module, calls the external reset for the chip.
  • The reset is configured by keeping this pin LOW that is not dependent on the internal resets.
  • The noise filters are present in the MCLR executing process and are very useful to remove and detect small pulses.

Watchdog Timer

  • PIC12F675 comes with a built-in watchdog timer that takes the controller in a reset position if the program hangs up during compilation or gets stuck in the infinite loop.
  • The watchdog timer is nothing but a countdown timer.

PIC Compiler

  • Microchip has created its own standard compiler that is mainly used for the PIC controller called MPLAB C18 Compiler. This compiler is available on the microchip site.
  • These Top 3 PIC C Compilers give the flexibility to choose from and pick any compiler as per your requirements, however, MikroC Pro For PIC is a third-party software mainly used as a replacement of Microchip standard compiler.
  • The code we write in the compiler generates a hex file which is then uploaded to the microcontroller to execute the number of instructions.
  • Burner and Compiler are two different things where Burner is used to burning the required program in the controller and compiler is used to write the program for the controller. The PICKit3 is a standard burner used for the PIC controller.
  • There are other burners available in the market but PICKit3 is mostly used and stays ahead of other burners in terms of efficiency and performance.

PIC12F675 Memory Layout

A memory of the controller is very helpful to store the number of instructions in the form of code. The memory is mainly divided into two types

  • 1. Program Memory 
  • 2. Data Memory

Program Memory

  • The program memory is also known as the ROM of the controller that stores the information permanently and contains memory space around 1.7K.
  • This memory doesn't depend on the power supply source and comes with the ability to retain information in the absence of a power supply.
  • It contains a 13-bit program counter that can address 8k x 14 program space where the interrupt vector lies at 0004h while the reset vector stays at 000h and is loaded by the controller.
  • The first memory space 1k x 14 rangings (0000h – 03FFh) is physically implemented.

Data Memory

  • The data memory, also known as RAM, stores the information temporarily and more often than not is called volatile memory.
  • It is widely dependent on the power supply and can not store information in the absence of the power supply.
  • The data memory is categorized into two banks that further contain two types of registers called:
  1. Special Function Registers
  2. General Purpose Registers

The first 32 locations of each bank are allocated for special function registers that can handle and control the peripheral functions and are classified as “Core and Peripheral”. While general-purpose registers are implemented as static RAM and lie at 20h-5Fh and are mapped across both banks.

PIC12F675 Block Diagram

  • Block diagram gives you an overview of different functions and components of the device i.e. how they are used and connected with each other.
  • The following figure shows the block diagram of PIC12F675.
  • PIC12F675 is an 8-bit controller that comes in PDIP, SOIC and MLF-S packages, however, PDIP is mainly preferred and used for the development of individual projects.
  • The addition of a 10-bit ADC converter makes this device compatible with a number of sensors.

Why Use PIC Microcontroller

Availability of special functions on a single chip is what sets apart PIC controller from other processors. Some real-time applications related to embedded and control systems can only be performed using PIC controllers as they come with high efficiency and decent speed to execute a number of instructions.

These controllers are cheap and remove the need for external components as they can perform a number of operations on a single chip. Power saving modes are added to the device that makes them an ideal choice for applications where power limitation is a major concern.

Maximum code protection is incorporated into the device that saves the device from influencing the code with external parameters, giving full code protection without a minor change in the compiled code.

The watchdog timer is a remarkable feature added in most of the devices that save the module from going into the infinite loop that may hang up the device and puts the device in a total stall.

Needless to say, PIC controllers play a vital role in driving automation in real-time applications using minimum circuitry that covers less space and turns out to be lightweight.

PIC12F675 Projects and Applications

  • Mainly used in student projects
  • Automation and Embedded Systems
  • Motor Controlling and Interfacing with Sensors
  • Security Systems
  • Industrial Automation
  • Medical Equipment

That's all for today. I have tried my best to give you everything related to PIC12F65. However, if you are feeling skeptical or have any questions, you can ask me in the comment section below, I'd love to help you according to the best of my expertise. You are most welcome to keep us updated with your feedback and suggestions so we always come with the relevant content as per your needs and demands. Thanks for reading the article.

Introduction to PIC16F690

Hi Guys! Hope you are doing well. We are here to keep you updated with valuable information related to engineering and technology. Today, I will unlock the details on the Introduction to PIC16F690. It is a 20-pin Flash-based PIC microcontroller that comes with high-performance RISC CPU and mainly used in automation and embedded systems. If high processing speed and memory space is anything to go by, this PIC module has already made a renowned place in the market where it can handle electronic projects pretty well. If you are a newbie or an expert, you can start working on the PIC module with little or no prior knowledge. In this post, I'll cover everything related to PIC16F690, its pinout, pin description, main features, block diagram, memory layout, and applications. Let's dive in and explore everything you need to know.

Introduction to PIC16F690

  • PIC16F690 is an 8-bit PIC microcontroller, developed by Microchip, that comes with 20-pin interface.
  • High-performance RISC CPU is incorporated on the board that helps in executing the instructions with a decent pace.
  • Crystal oscillator up to 20 MHz can be interfaced with the board that creates the clock pulses.
  • Operating voltage is identical to other controllers in the PIC community and ranges from 2 to 5.5 V. Program memory and RAM memory is 7K and 256 bytes respectively. EEPROM also comes with memory space around 256 bytes.
  • Other features that make this device compatible with a wide number of external components include I2C, SPI, and USART communications.
  • ADC module is very useful to convert analog values to digital ones and play a vital role for sensor interfacing.
  • PIC16F690 comes with two different packages called PDIP and QFP where both contain 20-pins onboard.

PIC16F690 Pinout and Description

You have got a brief overview of this controller. In this section, we uncover the pinout and pin details, so you get a clear idea about the function of each pin.
Pinout
Following figure shows the pinout of PIC16F690.
  • Both PIC packages are very helpful for project development where PDIP is mainly used for individual projects and QFN is incorporated in the industrial electronic devices.
Pin Description
Following figure shows the complete pin description of each pin that will highlight the main functions each pin capable of doing.
Pin# Pin Name Pin Description
19 RA0 AN0/ULPWU C1IN+ IOC ICSPDAT Digital I/O Pin Analog Channel 0 Comparator Interrupt Basic
RA1 AN1/VREF+ C12IN0- IOC ICSPCLK Digital I/O Pin Analog Channel 1 Comparator Interrupt Basic
RA2 AN2 C1OUT T0CKI IOC Digital I/O Pin Analog Channel 2 Comparator Timer Interrupt
4 RA3 IOC MCLR VPP Digital I/O Pin Interrupt Master Clear Reset Programming Voltage Input
3 RA4 AN3 T1G IOC OSC2/CLKOUT Digital I/O Pin Analog Channel 3 Timer Interrupt Oscillator Output
2 RA5 T1CKI IOC OSC1/CLKIN Digital I/O Pin Timer Interrupt Oscillator Input
13 RB4 AN10 SDI/SDA IOC Digital I/O Pin Analog Channel 10 SSP Interrupt
12 RB5 AN11 RX/DT IOC Digital I/O Pin Analog Channel 11 Serial Receive Pin Interrupt
11 RB6 SCL/SCK IOC Digital I/O Pin SSP Interrupt
10 RB7 TX/CK IOC Digital I/O Pin Serial Transmit Pin Interrupt
16 RC0 AN4 C2IN+ Digital I/O Pin Analog Channel 4 Comparator
15 RC1 AN5 C12IN1- Digital I/O Pin Analog Channel 5 Comparator
14 RC2 AN6 C12IN2- P1D Digital I/O Pin Analog Channel 6 Comparator ECCP
7 RC3 AN7 C12IN3- P1C Digital I/O Pin Analog Channel 7 Comparator ECCP
6 RC4 C2OUT P1B Digital I/O Pin Comparator ECCP
5 RC5 CCP1 P1A Digital I/O Pin ECCP
8 RC6 AN8 Digital I/O Pin Analog Channel 8
9   RC7 AN9 Digital I/O Pin Analog Channel 9
1 VDD Voltage Supply Pin
20 VSS Ground Pin

2. PIC16F690 Features

In this section, we discuss the main features of PIC16F690 so you get a hold of this chip before you make a final decision to install it in the relevant project. Following table shows the complete features of PIC16F690.
PIC16F690 Features
No. of Pins 20
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
No. of I/O Pins 18
Program Memory 7K
RAM 256 Bytes
EEPROM 256 Bytes
10-Bit ADC 12 Channels
Oscillator up to 20 MHz
Timer (3) 8-Bit Timer (2) 16-Bit Timer (1)
USART Protocol 1
I2C Protocol Yes
SPI Protocol  Yes
Comparators 2
Watchdog Timer Yes
Power-on Reset Yes
Brown Out Reset Yes
Master Clear Reset Yes
Power up Timer Yes
Selectable Oscillator Option Yes
Maximum Current Drawn Each Pin 25mA
Data Retention Capability 40 Years
Power Saving Sleep Mode Yes

3. PIC16F690 Functions

This PIC comes with an ability to perform a number of valuable functions like other controllers in the PIC community. Following are the main functions of PIC16F690.
Timer
Timers are very useful for creating a delay in the running function. PIC16F690 comes with three timers where two are 8-bit and one is 16-bit timer that can be configured both ways i.e. timer and counter. The former is used to create delay and increments the instruction cycle while later is used to count the number of intervals in specific running function and increments the rising and falling edge of the pin.
USART Module
PIC16F690 contains USART module that consists of two pins called TX and RX where former is a transmission pin used for transmitting serial data to other devices and later is a receive pin used for receiving serial data.
In-Circuit Serial Programming
In-Circuit Serial Programming is another valuable feature incorporated into the device that gives the flexibility to program the controller after its installation in the relevant project.
Watchdog Timer
PIC16F690 comes with built-in timer called watchdog timer that can be configured with programming. It is mainly used to reset the controller when the running program gets stuck in an infinite loop. This timer prevents the device from any malfunctioning and provides a preventive measure by resetting the device before it goes to any invalid software glitch. More often than not, watchdog timer acts like a countdown timer that starts from 1000 and gradually goes down to zero.
Sleep Mode
Power saving sleep mode is another valuable function added in the chip that generates a low current power down mode. The sleep mode can be abandoned using an interrupt, watchdog timer or external reset.

4. PIC Compilers

  • MPLAB C18 Compiler is a standard compiler, introduced by Microchip, that is mainly used for PIC controllers. You can download this compiler online from the Microchip Official Site.
  • Third-party software can also be used for compiling the program and MikroC Pro For PIC is available for this purpose.
  • You must check this list of Top 3 PIC C Compilers where you can pick any compiler based on your technical requirements.
  • The code we write in the compiler generates a hex file that is transferred to the PIC Microcontroller.
  • You need a burner to transfer the compiled program to the controller. PICKit3 is widely used for this purpose. There are other unofficial burners used for burning the code, however, PICKit3 is mostly preferred and used for PIC controllers.

5. PIC16F690 Memory Organization

Memory plays a vital role to store the number of instruction on the controller. It is mainly divided into three types called Program Memory EEPROM Memory RAM Memory Program memory comes with 13-bit program counter that can address 8k x 14 memory space where reset vector stays at 0000h and interrupt vector stays at 0004h. It has a total memory space around 7k and is known as ROM or non-volatile memory that stores the program permanently and doesn't depend on the voltage source.
  • EEPROM also stores information permanently but comes with one exception i.e. i.e. the instructions in EEPROM can be controlled and modified during the controller operation.
RAM memory stores the information temporarily and is known as a volatile memory or data memory that is mainly dependent on the power supply as it removes the stored information as the power supply is removed.
  • Registers play a vital role in the controller that are the data holding places and can hold storage address, instruction and any kind of data containing bit sequence or individual characters.
The data memory, implemented as static RAM, is divided into four banks and contain two types of registers called General Purpose Registers Special Function Registers General purpose registers store any modified or random value in the processor, and are organized as 8 x 256 in RAM and accessed by File Select Register. While Special function registers mainly control the peripheral functions and occupy the first 32 locations of each bank. W Register. This register belongs to GPRs and is accessible by a program. It doesn't take part in any register bank where desired values must be written on it and moved to the target register before defining them for available ports. STATUS. This register helps in switching between the banks.

6. PIC16F690 Block Diagram

Block diagram is very helpful to have a deeper look at how different pins and components operate and attach to each other. The following figure shows the block diagram of PIC16F690. This PIC module comes with three ports A, B and C and each one contains 6, 4 and 8 pins respectively.

7. PIC16F690 Projects and Applications

  • Students project for interfacing sensor and motor controlling
  • Central heating projects
  • For serial communication
  • Production of temperature data logger
  • Main part of the embedded system
  • Used in industrial automation
  • Used in security systems
  • Gas sensor projects
  • Starter Kits

8. Why Select PIC Microcontrollers

PIC controllers play a vital role in the development of many electronic projects that are directly or remotely related to automation. These controllers house a number of peripheral functions that prevent you from spending extra money to buy and connect external components for driving relevant operation. PIC controllers and burners are readily available and you can get support from Microchip site that not only helps you pick a right microcontroller but also helps in the development of your desired project. PIC controllers are highly economical, cover less space and turn out to be very lightweight that make your project a true manifestation of innovative ideas. That's all for today. I hope I have given you everything you needed to know about PIC16F690. If you are unsure or have any question, you can ask me in the comment section below. I'll try my best to resolve your queries. Keep us updated with your valuable feedback so we keep providing quality content as per your needs and demands. Thanks for reading the article.

Introduction to PIC16F676

Hi Friends! Hope you are doing well. Today, I'll cover the details on the Introduction to PIC16F676. It is an 8-bit CMOS PIC microcontroller, based on Flash and developed by Microchip. It comes in 14-pin interface with high-performance RISC CPU that makes it an ideal choice for most of the electronic applications that are widely related to embedded systems or industrial automation. This tiny chip incorporates everything you need to develop individual student projects. Memory space and a number of pins are little less as compared to other controllers in the PIC community, however, flash-based technology makes this device compatible with external devices. In this post, we'll discuss each and everything related to PIC16F676, its pinout and description, main features, block diagram, memory layout and applications. Let's dive right in and explore everything you need to know.

Introduction to PIC16F676

  • PIC16F676 is an 8-bit PIC microcontroller that comes with a 14-pin layout design. It is based on flash where high-performance CPU adds up the processing speed.
  • It comes in three packages called PDIP, SOIC, and TSSOP. All three versions are available in 14-pin configuration.
  • PIC16F676 contains program memory with memory space around 1.7 KB, while RAM and EEPROM memories are 64 bytes and 128 bytes respectively.
  • One ADC module is added in the device that is 10-bit and comes with 8 analog channels. This module plays a vital role for sensor interfacing and converting analog values to digital ones.
 
  • Power on Reset, Comparator, in-circuit serial programming, and master clear reset are some other features incorporated in the device that help it stay ahead of the other onboard chips and remove the need of buying external components for carrying out different operations.

1. PIC16F676 Pinout and Description

You have got a brief overview of this controller. In this section, we will cover both pinout and pin description of each pin. Let's start.
Pinout
The following figure shows the pinout of PIC16F676
Pin Description
Pin description will help you understand the main function associated with each pin. Following table shows the complete description of each pin.
Pin# Pin Name Pin Description
13 RA0 AN0 CIN+ ICSPDAT Digital I/O Pin Analog Channel 0 Comparator Input Programming Data
12 RA1 AN1 CIN- VREF ICSPCLK Digital I/O Pin Analog Channel 1 Comparator Input Voltage Reference Programmin Clock  
11 RA2 AN2 COUT T0CKI INT Digital I/O Pin Analog Channel 2 Comparator Output Clock Input for Timer0 Interrupt
4 RA3 MCLR VPP Digital I/O Pin Master Clear Reset Programming Voltage Input
3 RA4 T1G AN3 OSC2 CLKOUT   Digital I/O Pin Gate Timer1 Analog Channel 3 Crystal Oscillator Output. In RC mode, this pin has a 1/4 frequency of OSC1  
2 RA5 T1CKI OSC1 CLKIN Digital I/O Pin Clock Timer1 Crystal Oscillator Input External Clock Input
10 RC0 AN4 Digital I/O Pin Analog Channel 4
9 RC1 AN5 Digital I/O Pin Analog Channel 5
8 RC2 AN6 Digital I/O Pin Analog Channel 6
7 RC3 AN7 Digital I/O Pin Analog Channel 7
6 RC4 Digital I/O Pin
5 RC5 Digital I/O Pin
14 VSS Ground Pin
1 VDD Voltage Supply Pin

2. PIC16F676 Features

You have got a hold of pinout and description of each pin till now. In this section, we highlight and discuss the features of this controller that make it unique from its counterparts. The following figure shows the complete features of PIC16F676.
PIC16F676 Features
No. of Pins 14
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 1.7 K
Program Memory Type Flash
RAM 64 Bytes
EEPROM 128 Bytes
ADC Number of ADC Channels 10-Bit 8
I/O Ports (2) I/O Pins A, C 12
Power Saving Mode Yes
External Oscillator up to 20 MHz
Timer (2) 16-Bit Timer (1) 8-Bit Timer (1)
Manufacturer Microchip
Comparators 1
Individual Programmable Weak Pull-ups Yes
EEPROM Data Retention 40 Years
Watchdog Timer Yes
Power on Reset Yes
Master Clear Reset Yes
In-Circuit Serial Programming Yes
Minimum Operating Temperature -40 C
Maximum Operating Temperature 125 C
  These features will help you pick the desired controller and assist you in making a final decision based on your project requirement.

3. PIC16F676 Functions

There are a number of functions associated with this PIC module. Following are the main functions of PIC16F676.
Master Clear Reset (MCLR)
The MCLR is an external reset for the chip that is executed by keeping this pin LOW. This pin is not dependent on the internal resets which also house the noise filter to detect and remove the small pulses in the path.
Timer
PIC16F676 comes with two timers where one is an 8-bit timer and other is 16-bit timers. They can be employed both ways i.e. as a timer as well as a counter. Both timers come with a clock select capability. The timer mode is used to create a delay in any function while a counter is used to count the number of the internals of any function.
In-Circuit Serial Programming
In-circuit serial programming (ICSP), also called In-system programming (ISP), is added in the device that helps in programming the device after installation in a certain project. 
Watchdog Timer
The watchdog timer is a very useful function that resets the controller if the running program gets stuck in an infinite loop or software shows an invalid status. It is very difficult to reboot the entire system in case there comes glitch, these timers save you a bunch of time and bring the system back to its initial position without human interference.

4. PIC Compiler

  • A compiler is a software used where we write a program to execute desired functions on the microcontroller. Microchip comes with its own standard compiler called MPLAB C18 Compiler. You can get this compiler online from the Official Microchip Site.
  • These Top 3 PIC C Compilers give you many options to choose from based on your requirements, however, MikroC Pro For PIC is mainly used for this purpose.
  • The code we write in the compiler creates a hex file which is then moved to the microcontroller to call and execute the desired instructions.
  • Burners are used to burn and incorporate the certain program on the controller. There are many unofficial burners available in the market but PICKit3 stay ahead in terms of ease of use and quality performance.

5. PIC16F676 Memory Layout

The memory of this controller is mainly divided into two types called Program Memory Organization (ROM) Data Memory Organization (RAM) The program memory stores the program permanently and is also known as ROM or non-volatile memory. It comes with 13-bit program counter that can address 8k x 14 program memory space. The first memory space 1k x 14 covering (0000h - 03FFh) can be physically implemented. The address stored in the reset vector is loaded by the controller and stays at 000h while the interrupt vector stays at 0004h. The RAM memory, also known as Data or volatile memory, stores the program temporarily and depends on the source of power supply. It removes the stored program as the power supply turns off. The data memory is mainly divided into two banks that further house two types of registers called Special Function Registers General Purpose Registers The first 32 locations of each bank are reserved for special function registers which are mainly used for handling and controlling the peripheral functions and are classified as "Core and Peripheral". While general purpose registers stay at 20h-5Fh,  mapped across both banks and are implemented as static RAM. STATUS Register. This register is mainly used to switch between the banks and it contains
  • Reset status
  • Arithmetic status of the ALU
  • Bank select bits for data memory (SRAM)
W Register. The W register doesn't relate to any register bank and is addressed by the program only. It is a GPR while STATUS register falls under the category of SFR. TRISA. This register configures PORTA as an input or output. The value 0 indicates it as an input and value 0 shows output. TRISC. This register is similar to TRISA and configures the pins as an input or output for PORTC.

6. PIC16F676 Block Diagram

Block diagram is very helpful to uncover the main functions associated with each component on the controller and how these functions are related to each other. The following figure shows the block diagram of PIC16F676.
  • This PIC module comes with two ports called PORTA and PORTC and each port contains 6 pins. It lacks some features like USART and comes with less memory space.

7. PIC16F676 Projects and Applications

PIC microcontrollers are widely used in many electronic systems for driving automation. Following are the main application of this controller version.
  • Prototyping custom circuits
  • GPS and security systems
  • Central heating projects
  • Student projects for sensor interfacing and motor controlling
  • Used in home and industrial automation
  • Embedded system

8. Why Use PIC MicroControllers

  • PIC controllers are very helpful for carrying out automation in many electronic devices and provide easy to configure and user-friendly interface.
  • A number of functions can be done on a single chip without buying external components, that make your project highly economical, and lightweight that covers less space.
  • Some chips have a builtin ADC module that makes them an ideal choice for the projects requiring digital output as a final result.
  • All the burners and PIC compilers are easily available that help you ease the learning process.
That's all for today. I hope you have found this article useful. If you have any question, you can approach me in the comment section below, I'd to help you in any way I can. Keep us updated with your valuable feedback and suggestion that help us provide you quality content as per your needs and requirements. Thanks for reading the article.

Introduction to PIC16F88

Hi, Hope you are doing well. I am back to give you a daily dose of useful information. Today, I'll uncover the details on the Introduction to PIC16F88. It is an 8-bit PIC microcontroller, introduced by Microchip, mainly used in automation and embedded applications. It comes with an enhanced flash processor and nanoWatt technology, helping it to consume minimum power with the ability to perform a number of functions on a single tiny chip. An ADC 10-bit module is added in the device that makes it compatible with other devices and accepts analog signal and converts it to a digital one. This microcontroller module houses little less memory space as compared to other controllers in the PIC community and comes with an 18-pin layout (PDIP). Though other modules with more number of pins are also available, PDIP is mostly used for developing individual student projects. In this tutorial, I'll cover each and everything related to PIC16F88, its pinout, features, block diagram, and applications. Let's jump right in and nail down everything you need to know.

Introduction to PIC16F88

  • PIC16F88 is an 8-bit PIC microcontroller that comes with the enhanced flash processor and nanoWatt technology. It is available in three different packages named PDIP, SSOP, and QFN. First one comes with an 18-pin layout  (mostly used) while other two comes in 20 and 28 pin packages respectively.
  • The program memory size is 7KB that is used to store the number of instruction on a single chip. While the RAM is 368 bytes and EEPROM comes with memory space around 256 bytes.
  • The 10-bit ADC is incorporated on the board that is mainly used to convert the analog signal into a digital one. It plays a vital role to interface sensors, where it gets their signal values in the analog form and convert them to digital ones.
  • The crystal oscillator up to maximum value of 20MHz can be interfaced with the chip that is mainly used to generate the clock pulses for the synchronization of the internal operations.
  • In terms of carrying out and driving functions that are directly or remotely related to automation, we can not brush off the importance of this module.

1. PIC16F88 Pinout and Description

The pinout of any module is very useful to implicate the layout of the module while pin description gives you an overview of what each pin is capable of doing. Let's discuss pinout and pin description one by one.
Pinout
The following figure shows the pinout of PIC16F88.
  • The PDIP module comes with 18-pin interface while other two SSOP and QFN consist of 20 and 28 pins respectively.
  • The former is used for developing individual projects while the other two are used and added in industrial electronic devices.
Pin Description
Following table shows the pin description of each pin and the main function associated with each pin.
Pin# Pin Name Pin Description
17 RA0 AN0 I/O Bidirectional pin Analog pin channel 0
18 RA1 AN1 I/O Bidirectional pin Analog pin channel 1
1 RA2 AN2 CVREF VREF- I/O Bidirectional pin Analog pin channel 2 Comparator Output (VREF) A/D reference voltage input (Low)
2 RA3 AN3 VREF+ C1OUT I/O Bidirectional pin Analog pin channel 3 A/D reference voltage input (High) Comparator 1 Output
3 RA4 AN4 T0CKI C2OUT   I/O Bidirectional pin Analog pin channel 4 Used for clock input to the timer0 Comparator 2 Output
4 RA5 MCLR VPP I/O Bidirectional pin This is a master clear low reset pin Programming voltage input
15 RA6 OSC2 CLKOUT I/O Bidirectional pin 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 RA7 OSC1 CLKIIN I/O Bidirectional pin This pin is connected to a crystal oscillator and acts as a crystal oscillator input pin External Clock Source Input
6 RB0 INT CCP1 I/O Bidirectional pin External interrupt pin Output for PWM and Compare and Input for Capture
7 RB1 SDI SDA All PORTB Pins are software programmed I/O Bidirectional pin SPI data in I2C data
8 RB2 SDO RX DT I/O Bidirectional pin SPI data out Receiver Pin Synchronous detect
9 RB3 PGM CCP1 I/O Bidirectional pin Programming enable pin for Low-Voltage ICSP™ PWM Output for Compare and PWM, while Input Capture
10 RB4 SCK SCL I/O Bidirectional (Interrupt-on-change) pin SPI Synchronous serial clock input/output I2C Synchronous serial clock Input
11 RB5 SS TX CK I/O Bidirectional (Interrupt-on-change) pin SPI Slave select Serial transmit pin Synchronous clock
12 RB6 AN5 PGC T1OSO T1CKI I/O Bidirectional (Interrupt-on-change) pin Analog pin channel 5 In-Circuit Debugger and programming clock pin. Oscillator output for Timer1 External clock input for Timer1
13 RB7 AN6 PGD T1OSI I/O Bidirectional (Interrupt-on-change) pin Analog pin channel 6 ICSP programming data and In-Circuit Debugger pin Oscillator input for Timer1
5 Vss Ground Pin
14 Vdd Voltage Supply Pin

2. PIC16F88 Features

Features of any device play an important role in order for you to decide and pick the most relevant PIC module for your project. These features differ for different modules available in the market. Before you start working on the project, make sure the features of the device are compatible and resonate with your project requirements and the nature of the final output. Following table shows the complete feature of PIC16F88.
PIC16F88 Features
No. of Pins 18 (PDIP)
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 7K
Program Memory Type Flash
RAM 368 Bytes
EEPROM 256 Bytes
ADC Number of ADC Channels 10-Bit 7
I/O Ports (2) I/O Pins A, B 16
Packages 18-pin PDIP 20-pin SSOP 28-pin QFN
External Oscillator up to 20 MHz
Timer (3) 16-Bit Timer (1) 8-Bit Timer (2)
Manufacturer Microchip
Comparators 2
SSP Yes
PWM 1 (10-Bit)
Watchdog Timer Yes
Comparators 2
Master Clear Reset Yes
In-Circuit Serial Programming Yes
Low Voltage Programming Yes
EEPROM Data Retention 40 Years
Minimum Operating Temperature -40 C
Maximum Operating Temperature 125 C
Technology Used NanoWatt

3. PIC16F88 Functions

There are a number of functions associated with this PIC module. Following are the main functions of PIC16F88.
Timer
PIC16F88 comes with one 16-bit and two 8-bit timers that can be employed both ways i.e. as a timer as well as a counter. These timers come with internal and external clock select capability. It is important to note that, the timer mode play a role to increment the instruction cycle while the counter mode increments the falling and rising edge of the pin.
In-Circuit Serial Programming
In-circuit serial programming (ICSP), also called In-system programming (ISP), is a useful function incorporated in the controller that helps it to program in the installation device, getting it rid to program before making it compatible to the required project.
Master Clear Reset (MCLR)
The MCLR, pin 4 in PDIP, calls the external reset for the chip. The reset is executed by keeping this pin LOW. The noise filter is included in the MCLR path that allows to remove and detect the small pulses while the MCLRE configuration bit disables MCLR input. It is worth mentioning here, this MCLR pin is not dependent on the internal resets.
USART
The USART module, that stands for Universal Synchronous and Asynchronous Receiver and Transmitter, is added in the device that is mainly used for laying out the serial communication with other devices. Two pins called TX and RX take part for serial communication where former is known as transmitting component that allows transmitting serial data while later is known as receiving a pin, used to receive the serial data.
Watchdog Timer
PIC16F88 comes with a built-in watchdog timer that helps in bringing the module in reset position if the program gets stuck in the infinite loop. This timer should be reset to the initial value after every 3 instructions in order to prevent it going to zero value. The watchdog timer is mainly a countdown timer that starts from 1000 and eventually goes down to zero.

4. PIC Compiler

  •  MPLAB C18 Compiler. is a standard compiler used for compiling the code in the controller. You can get this compiler online from the Official Microchip Site.
  • These Top 3 PIC C Compilers give you many options to choose from, but MikroC Pro For PIC is mainly used for this purpose, still, it depends on your needs and requirements.
  • The code we write in the compiler will generate a hex file which is then transferred to the microcontroller to call and execute the desired instructions.
  • There are many unofficial burners available in the market but PICKit3 is mostly preferred and used for the PIC controllers.

5. PIC16F88 Memory Layout and Working

So far you got a hold of pinout, description, features, and compiler used for the controller. In this section, we cover the memory layout that plays a vital role in the execution of the code. The memory of the module stores a number of instruction which can be divided into three major types named: Program Memory (ROM) RAM Memory (Data Memory) EEPROM Memory (Data Memory) Now we discuss each memory one by one and uncover the main features associated with them.
Program Memory
The Program memory is used for storing a running program permanently. It is also known as ROM memory or Non-Volatile memory and doesn’t depend on the power supply. The ROM memory is about 7K and is designed using FLASH Technology.
Data EEPROM
The EEPROM is a part of data memory and stores running program permanently with one exception i.e. this memory is indirectly mapped out, unlike Program memory that is directly mapped out. The EEPROM contains memory space around 256 bytes and can be accessed and addressed by multiple control registers.
Data RAM
RAM memory stores the program temporarily and removes the program once the power supply turns off. It is also known as volatile memory and is classified into two main parts called General-purpose registers (GPR) Special-function registers (SFR) The RAM memory registers are known as data holding places that can hold instruction, storage address, and any kind of data containing the individual character or bit sequence. The data memory can be employed as static RAM and is partitioned into multiple banks. The SRFs registers are mainly used to handle and control the peripherals modules. Following are the main registers available in the RAM memory. STATUS Register. This register is mainly used to switch between the mentioned banks. Setting the fifth bit of this register indicates the performance of bank1 while resetting it will address bank 0. TRISA. This register is used to configure PORTA as an input or output. The value 0 describes it as an input and value 0 shows output. TRISB. This register is similar to TRISA and used for configuring the pins as an input or output for PORTB. W Register. This register is not associated with any register bank and is addressed by the program only. It is a GPR while all other registers described above are SFR. It is important to note that, the required values are written on W register and transferred to the target register before writing them down on the PORTA or PORTB.

6. PIC16F88 Block Diagram

Block diagram helps you understand the main functions of the controller and how they work, associate and connect inside the controller body. The following figure shows the block diagram of PIC16F88.
  • This PIC module comes with two ports A and B and each port contains 8 pins where higher order bits belong to the STATUS register.
  • While CCP1 is dependent on CCPMX bit available in the Configuration Word 1 register.

7. PIC16F88 Projects and Applications

  • Student projects for sensor interfacing and motor controlling
  • GPS and security systems
  • Used in home and industrial automation
  • Prototyping custom circuits
  • Serial Communication
  • Central heating projects
  • Embedded system
  • Used in starter kits

8. Why Use PIC MicroControllers

  • PIC controllers were introduced with the intention to provide easy to use a module and easy to configure interface.
  • Gone are days when you have to buy a number of external components for carrying out different operations.
  • These controllers have built-in peripherals with a number of functions associated with each pin, getting you rid of buying extra components and make the whole project cheap in cost that covers less space and appears to be lightweight.
  • No need to add extra ADC module for converting analog values to digital values, as builtin ADC module incorporated in the tiny chip works best for interfacing different sensors on the board.
  • The compiler and burner for the controllers are readily available in the market. Live support is available on the Microchip site where you will get your queries answered sooner than late.
That’s all for today. I hope I have given you everything you needed to know about PIC16F88. If you are unsure 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 that help us provide you quality work so you keep coming back for what we have to offer. Thanks for reading the article.

Introduction to PIC18F4520

Hi Friends! Hope you are doing well. In this platform we mainly cover information related to engineering and technology, no matter if you are a newbie or experts, you'll find something handy that may resonate with your field of interest. Today, I'll unlock the details on the Introduction to PIC18F4520. It is an 8-bit enhanced flash PIC microcontroller that comes with nanoWatt technology and is based on RISC architecture. Many electronic applications house this controller and cover wide areas ranging from home appliances, industrial automation, security system and end-user products. This microcontroller has made a renowned place in the market and becomes a major concern for university students for designing their projects, setting them free from the use of a plethora of components for a specific purpose, as this controller comes with inbuilt peripheral with the ability to perform multiple functions on a single chip. In this tutorial, I'll cover each and everything related to PIC18F4520, its pinout, main features, block diagram, and applications. Let's dive right in and nail down everything you need to know.

Introduction to PIC18F4520

  • PIC18F4520 is a PIC microcontroller, introduced Microchip, and mainly used in automation and embedded systems. It comes in three packages known as PDIP, QFN, and TQFP where the first one is 40-pin (mostly used) while other two come with a 44-pin interface.
  • This microcontroller version comes with CPU, timers, 10-Bit ADC and other peripherals that are mainly used to develop a connection with external devices.
  • This PIC version, like other models in the PIC community, contains everything that is required to make an embedded system and drive automation.
  • The PIC18F4520 contains 256 bytes of EEPROM data memory, 1536 bytes of RAM, and program memory of 32K.
  • It also incorporates 2 Comparators,10-bit Analog-to-Digital (A/D) converter with 13 channels, and houses decent memory endurance around 1,000,000 for EEPROM and 100,000 for program memory.
  • The Enhanced Universal Asynchronous Receiver Transmitter (EUSART) feature is useful for developing the serial communication with other devices.
  • The asynchronous serial port is added on the chip that can be interfaced both ways i.e. 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) Bus.
The functions that make this device unique in terms of functionality and ease of use include
  • Wide operating voltage range (2.0V-5.5V)
  • Multiplexed Master Clear with pull-up/input pin
  • In-Circuit Serial Programming™ (ICSP™) via two pins
  • Power-Saving Sleep mode
  • C compiler optimized architecture
  • Industrial and Extended Temperature range
  • Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)
  • Power-on Reset (POR)
  • In-Circuit Debug (ICD) via two pins
  • Brown-out Reset (BOR) with software control option
  • Watchdog Timer (WDT)

1. PIC18F4520 Pinout and Description

You have got a clear idea about this PIC18F4520 model. In this section, we jot down the pinout of the controller and cover a detailed description of each pin.
PIC18F4520 Pinout
Following figure shows the pinout of PIC18F4520.
  • The PDIP module comes with 40-pin interface while other two QFN and TQFP contain 44-pin on each module.
  • The former module is mainly used for developing individual projects while the other two are incorporated in industrial electronic devices.
Pin Description
Every pin on the module comes with a unique function, used as per the requirement of the project. And some pins incorporate multiple functions. The following figure shows the complete pinout description of this tiny PIC module.
Pin# Pin Name Pin Description
2 RA0/AN0 RA0 AN0 Digital I/O Pin Analog Input 0 Pin
3 RA1/AN1 RA1 AN1 Digital I/O Pin Analog Input 1 Pin
4 RA2/AN/VREF- RA2 AN2 VREF- Digital I/O Pin Analog Input 2 Pin ADC Reference Input Voltage (low)
5 RA3/AN/VREF+ RA3 AN3 VREF+ Digital I/O Pin Analog Input 3 Pin ADC Reference Input Voltage (high)
6 RA4/T0CKI/C1OUT RA4 T0CKI C1OUT Digital I/O Pin External clock input for Timer0 Output Comparator 1
7 RA5/AN4/SS/HLVDIN/C2OUT RA5 AN4 SS HLVDIN C2OUT Digital I/O Pin Analog Input 4 Pin Slave Select input for SPI (High, Low) Detect Input for Low Voltage Output Comparator 2
33 RB0/INT0/FLT0/AN12 RB0 INT0 FLT0 AN12 PORTB can be programmed with software Digital I/O Pin External Interrupt 0 Fault Input for Enhanced CCP1 Analog Input
34 RB1/INT1/AN10 RB1 INT1 AN10 Digital I/O Pin External Interrupt 1 Analog input 10
35 RB2/INT2/AN8 RB2 INT2 AN8 Digital I/O Pin External Interrupt 2 Analog input 8
36 RB3/CCP2 RB3 AN9 CCP2 Digital I/O Pin Analog input 9 Output for Compare2 and PWM2, and Input for Capture2
37 RB4/KBI0/AN11 RB4 KBI0 AN11 Digital I/O Pin Interrupt-on-change pin Analog input 11
38 RB5/KBI1/PGM RB5 KBI1 PGM Digital I/O Pin Interrupt-on-change pin ICSP programming enable pin for low voltage  
39 RB6/KBI2/PGC RB6 KBI2 PGC Digital I/O Pin Interrupt-on-change pin ICSP programming clock and In-Circuit Debugger pin
40 RB7/KBI3/PGD RB7 KBI3 PGD Digital I/O Pin Interrupt-on-change pin ICSP programming data and In-Circuit Debugger pin
15 RC0/T1OSO/T13CKI RC0 T1OSO T13CKI Digital I/O Pin Oscillator output for Timer1 External clock input for Timer1/Timer3
16 RC1/T1OSI/CCP2 RC1 T1OSI CCP2 Digital I/O Pin Oscillator input for Timer1 Output for Compare2 and PWM2, Input for Capture2
17 RC2/CCP1/P1A RC2 CCP1 P1A Digital I/O Pin Output for Compare1 and PWM1, Input for Capture1 Enhanced CCP1 Output
18 RC3/SCK/SCL RC3 SCK SCL Digital I/O Pin SPI Module Synchronous serial clock input/output I2C Module Synchronous serial clock input/output
23 RC4/SDI/SDA RC4 SDI SDA Digital I/O Pin SPI Data-In Pin I2C Data I/O Pin
24 RC5/SDO RC5 SDO Digital I/O Pin SPI Data-Out Pin
25 RC6/TX/CK RC6 TX CK Digital I/O Pin Asynchronous Transmit (USART) Synchronous Clock (USART)
26 RC7/RX/DT RC7 RX DT Digital I/O Pin Asynchronous Receive (USART) Synchronous Data (USART)
19 RD0/PSP0 Digital I/O Pin Parallel Slave Port (PSP) for D0 with TTL input buffers
20 RD1/PSP1 Digital I/O Pin Parallel Slave Port for D1 with TTL input buffers
21 RD2/PSP2 Digital I/O Pin Parallel Slave Port for D2 with TTL input buffers
22 RD3/PSP3 Digital I/O Pin Parallel Slave Port for D3 with TTL input buffers
27 RD4/PSP4 Digital I/O Pin Parallel Slave Port for D4 with TTL input buffers
28 RD5/PSP5 Digital I/O Pin Parallel Slave Port for D5 with TTL input buffers
29 RD6/PSP6 Digital I/O Pin Parallel Slave Port for D6 with TTL input buffers
30 RD7/PSP7 Digital I/O Pin Parallel Slave Port for D7 with TTL input buffers
8 RE0/RD/AN5 RE0 RD AN5 Digital I/O Pin PSP Read Control Analog input 5 Pin
9 RE1/WR/AN6 RE1 WR AN6 Digital I/O Pin PSP Write Control Analog input 6 Pin
10 RE2/CS/AN7 RE2 CS AN7 Digital I/O Pin PSP Chip Select Control Analog input 7 Pin
1 MCLR/VPP MCLR VPP ICSP Programming Enable Pin Master Clear Active Low Reset Pin
13 OSC1/CLKI OSC1 CLKI Crystal Oscillator Input Pin
14 OSC2/CLKO/RA6 OSC2 CLKO RA6 Crystal Oscillator Output Pin
12,31 VSS Ground pin
11,32 VDD Voltage pin
  • This table will help you understand the function associated with each pin.

2. PIC18F4520 Features

Features are very important for any device that makes it unique from its counterparts. The following figure shows the complete features of PIC18F4520.
PIC18F4520 Features
No. of Pins 40
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 32K
Program Memory (Instructions) 16384
RAM 1536 Bytes
EEPROM 256 Bytes
ADC Number of Channels 10-Bit 13
I/O Ports (5) I/O Pins A,B,C,D,E 36
Packages 40-pin PDIP 44-pin QFN 44-pin TQFP
External Oscillator up to 40 MHz
Timer (4) 16-Bit Timer (3) 8-Bit Timer (1)
USART Protocol 1
I2C Protocol Yes
SPI Protocol Yes
Brown-out Reset Yes
Watchdog Timer Yes
Comparators 2
Master Synchronous Serial Port (MSSP) module 1
Capture/Compare/PWM 16bit/16bit/10bit
Power Saving Sleep Mode Yes
Selectable Oscillator Option Yes
Operating High-current sink/source Each pin 25mA
Programmable High/Low-Voltage Detect -Yes
Oscillator Start-up Timer Yes
  • These features help you identify the main characteristics of the controller that are appropriate for designing and developing for the certain project.

3. PIC18F4520 Functions

This PIC model is capable of performing many functions similar to other controllers in the PIC community. Following are the main functions of PIC18F4520.
Timer
PIC18F4520 comes with three 16-bit and one 8-bit timer that can be used as a timer as well as a counter. All three timers contain internal and external clock select capability. The timer mode mainly increments the instruction cycle while the counter mode is used to increment the rising and falling edge of the pin.
Brown Out Reset (BOR)
The BOR is a very useful function that allows this controller to reset once the Vdd (voltage supply) drops below a brownout threshold voltage. The multiple voltage ranges are used and provided to protect the chip once the power drops at the voltage supply line. The Power Up Timer must be kept enabled, in order to put the delay in returning the device from a BOR function, t The BOR mode can be configured both ways i.e. through BOREN settings in a register as well through programming.
In-Circuit Serial Programming
In-circuit serial programming (ICSP), also called In-system programming (ISP), is a feature added to this device that makes it enable to be programmed in the required system after installation, setting it free from programming the device before making it compatible with the certain project.
USART
This controller version comes with USART module, that stands for Universal Synchronous and Asynchronous Receiver and Transmitter, and is mainly used for setting up the serial communication with external devices. There are two parts of this module called TX and RX where former is known as transmitting component that is used for transmitting serial data while later is known as receiving component, used for receiving the serial data across the attached devices.
Watchdog Timer
PIC18F4520 contains a built-in watchdog timer that brings the controller in reset position if the program hangs up during compilation or gets stuck in the infinite loop. It is worth mentioning here, this timer must be reset to the initial value after every 3 instructions in order to avoid it going to zero value in normal conditions. The watchdog timer is more or less a countdown timer that starts from 1000 and ultimately goes down to zero.
Power On Reset
Power On Reset function is very helpful and resets the controller and starts it from scratch when Vdd raises above a certain threshold value. This function is very useful to prevent the device from malfunctioning.
Power Managed Modes
PIC18F4520 provides total 7 operating modes that help in more efficient power management. These modes offer multiple options for selective power conservation in a variety of applications. The power managed modes are mainly divided into three main categories called:
  • Run modes
  • Sleep mode
  • Idle modes
These categories help in identifying the areas of the device that are clocked at a specific speed. The Idle and Run modes can operate in any of three clock sources named primary, secondary, and internal oscillator block while Sleep mode is not involved in any clock source. The switching feature is added in the power managed modes that use the Timer1 oscillator as a replacement of a primary oscillator. All clocks will be cleared and stopped working in the Sleep mode.
Master Clear Reset (MCLR)
The MCLR pin is used for calling the external reset for the chip. The reset is triggered by keeping this pin at a LOW value and is not dependent on the internal resets. The noise filter is added in the MCLR executing process that helps in detecting and removing the small pulses. The MCLRE configuration bit can also be used to disable MCLR input.

4. PIC Compiler

  • Microchip comes with its own standard compiler for the PIC controller called MPLAB C18 Compiler. You can get this compiler online from the Official Microchip Site.
  •  MikroC Pro For PIC is a third party software mainly used as a replacement of Microchip standard compiler.
  • These Top 3 PIC C Compilers give you many options to choose from to pick any compiler as per your needs and demands.
  • The code written in the compiler generates a hex file which is then uploaded to the microcontroller to execute the number of instructions.
  • The PICKit3 is a standard PIC burner, mainly used for burning the code in the controller. There are other burners also available in the market but PICKit3 is mostly used and preferred for the PIC controllers.

5. PIC18F4520 Memory Layout and Working

The memory of the module is very useful for storing a number of instruction which can be divided into three major types: Program Memory Data EEPROM Data RAM Let's discuss each memory one by one and highlight the main functions associated with them.
Program Memory
The Program memory, also known as ROM memory or Non-Volatile memory, stores the running program permanently. It doesn't depend on the power supply i.e. stores the program in the absence of the main power supply.  The ROM memory is about 32K and is made with FLASH Technology.
Data EEPROM
This memory is similar to ROM memory in one way or the other and stores running program permanently with one limitation i.e. the instructions in EEPROM can be controlled and modified during the controller operation. The EEPROM comes with memory space around 256 bytes and can be accessed and addressed by multiple control registers.
Data RAM
RAM memory, also known as volatile memory, stores the program temporarily and removes the stored program once the power supply is removed. It is classified into two main parts called General-purpose registers (GPR) Special-function registers (SFR) This memory is volatile in nature as it stores the program temporarily and is power dependent i.e. once the power supply is turned off the instructions stored in the RAM will be removed. The RAM memory registers are the data holding places that can hold instruction, storage address, and any kind of data ranging from an individual character to bit sequence. The data memory can be employed as static RAM where each register comes with a 12-bit address. This memory is comprised of a total 16 banks and each bank contains a memory space of around 256 bytes. Let’s discuss few registers in details. STATUS Register. This register is mainly used to switch between the mentioned banks. Setting the fifth bit of this register indicates the performance of bank1 while resetting it will address bank 0. TRISA. This register plays a vital role to configure PORTA as an input or output. The value 1 describes it as an output and value 0 shows input. TRISB. This register is similar to TRISA and used for deciding the pins as an input or output of PORTB. W Register. This register is a GPR while all other described above belong to SFR. It is not associated with any register bank and is addressed by the program only. The required values are written on W register and moved to the target register before writing them down on the available ports.

6. PIC18F4520 Block Diagram

You have got a brief overview of pinout, its description and main features of the controller. In this section, we discuss the main block diagram of the microcontroller so you can get an idea how each function in the controller is related and connected to each other.
  • PIC18F4520 comes with five ports where each port contains 8 pins except the E port that comes with 4 pins which also include MCLR (master clear pin).
  • This device can be configured using 10 different oscillator modes where different capacitor values are required to generate acceptable oscillator operation. The user must test oscillator performance with the suitable VDD and temperature range for the required project.

7. PIC18F4520 Projects and Applications

  • PIC18F4520 is widely used in home and industrial automation
  • Student projects for motor controlling and sensor interfacing
  • GPS and security systems
  • Gas sensor projects
  • Production of temperature data logger
  • Serial Communication
  • Central heating projects
  • Embedded system

8. Why Use PIC MicroControllers

  • PIC microcontrollers are widely used in multiple applications as they come with user-friendly interface and easy onboard architecture that requires little or no prior skills before getting familiar with the chip.
  • They can perform a number of functions using minimum circuitry and are cheap in price as compared to other modules available in the market.
  • Minimum power consumption is another ability that makes this controller an ideal choice for the projects where power limitation is a major concern.
  • PIC controllers stay ahead of other Atmel controller like 8051 in terms of their higher processing speed and efficiency.
That's all for today. I hope this article has helped you got a complete overview of PIC18F4520 and the main functions associated with it. If you are unsure or feeling skeptical, you can ask me in the comment section below. I'd love to assist you in any way I can. Feel free to give your feedback and suggestions that help us provide you quality work based on your needs and requirements. Thanks for reading the article.

Introduction to PIC16F887

Hey Guys! Hope you are doing well. This is a platform where we keep you updated with valuable information so you keep coming back for what we have to offer. Today, I'll uncover the details on the Introduction to PIC16F887. It is a 40-pin PIC microcontroller, introduced by Microchip, and is a successor of PIC16F877A. Microcontrollers have revitalized the technology by providing a flawless interface and an ability to perform numbers of functions on a single chip. Gone are days, when you had to rely on external components to develop your projects which might be time-consuming, covered more space, and required a number of prior skills before making your project in real time. Microcontrollers have made things easy by covering each and every aspect of the projects that are directly or remotely related to automation. In this tutorial, I'll discuss each and everything related to PIC16F887 including its main features, working, pinout and applications. Let's jump right in and nail down everything you need to know.

Introduction to PIC16F887

  • PIC16F887 is a 40-pin (for PDIP package) and 8-bit CMOS PIC Microcontroller that comes with nanoWatt technology. Economical price and user-friendly architecture make this device easy to use and easy to configure.
  • It is available in three packages known as PDIP, QFN, and TQFP. The first one comes with a 40-pin layout design while remaining two contains 44 pins on each layout.
  • This PIC version, like other models in the PIC community, contains everything that is required to make an embedded system and drive automation.
  • The PIC16F887 incorporates 256 bytes of EEPROM data memory, 368 bytes of RAM, and program memory of 8K.
  • Apart from self-programming capability, it also contains 2 Comparators,10-bit Analog-to-Digital (A/D) converter with 14 channels, and capture, compare and PWM functions.
  • The asynchronous serial port is added on the chip that can be configured both ways i.e. the 2-wire Inter-Integrated Circuit (I²C™) Bus or 3-wire Serial Peripheral Interface (SPI™)
  • The Enhanced Universal Asynchronous Receiver Transmitter (EUSART) feature makes this chip compatible with the devices where serial communication is an integral part of the project.
  • The functions that make this device unique in terms of ease of use include
  1. Power-Saving Sleep mode
  2. Industrial and Extended Temperature range
  3. Wide operating voltage range (2.0V-5.5V)
  4. SR Latch mode
  5. Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)
  6. Power-on Reset (POR)
  7. Ultra-Low-Power Wake-up (ULPWU)
  8. Multiplexed Master Clear with pull-up/input pin
  9. Individually programmable weak pull-ups
  10. Brown-out Reset (BOR) with software control option
  11. Enhanced low-current Watchdog Timer (WDT)
  • Needless to say, this PIC version is an ideal choice to drive A/D conversion in automotive, consumer, and industrial applications.

1. PIC16F887 Pinout & Description

Getting a hold of Pinout and Pin descriptions is mandatory to check the working of each pin on this tiny chip. If you are a newbie or an expert, you need to know the function associated with each pin for a better understanding of the chip.
Pinout
The following figure shows the complete pinout of all three packages called PDIP, QFN, and TQFP.

  • As described earlier, the PDIP package contains 40-pin while other two come with 44 pins.
Pin Description
PIC16F887 is widely used in many electronic applications. Some pins in the controller are capable of doing more than one functions that allow us to use the pin according to the needs and demands of the project. I have listed the function of each pin in the following table.
Pin# Pin Name Pin Description
2 RA0 AN0/ULPWU C12IN0- Digital I/O Pin Analog Input 0 Pin Comparator
3 RA1 AN1/ULPWU C12IN1- Digital I/O Pin Analog Input 1 Pin Comparator
4 RA2 AN2 C2IN+ VREF-/CVREF Digital I/O Pin Analog Input 2 Pin Comparator ADC Reference Input Voltage (low)
5 RA3 AN3 C1IN+ VREF+ Digital I/O Pin Analog Input 3 Pin Comparator ADC Reference Input Voltage (high)
6 RA4 C1OUT T0CKI Digital I/O Pin Comparator External clock input for Timer0
7 RA5 AN4 C2OUT SS Digital I/O Pin Analog Input 4 Pin Comparator Slave Select input for SPI
33 RB0 AN12 IOC/INT Digital I/O Pin Analog Pin Interrupt-on-change
34 RB1 AN10 C12IN3- IOC Digital I/O Pin Analog Pin Comparator Interrupt-on-change
35 RB2 AN8 IOC Digital I/O Pin Analog Pin Interrupt-on-change
36 RB3 AN9 C12IN2- IOC PGM Digital I/O Pin Analog Pin Comparator Interrupt-on-change Basic
37 RB4 AN11 IOC Digital I/O Pin Analog Pin Interrupt-on-change
38 RB5 AN13 T1G IOC Digital I/O Pin Analog Pin Timer Interrupt-on-change
39 RB6 IOC ICSPCLK Digital I/O Pin Interrupt-on-change pin Basic
40 RB7 IOC ICSPDAT Digital I/O Pin Interrupt-on-change pin Basic
15 RC0 T1OSO/T1CKI Digital I/O Pin Timer
16 RC1 T1OSI CCP2 Digital I/O Pin Timer ECCP
17 RC2 CCP1/P1A Digital I/O Pin ECCP
18 RC3 SCK/SCL Digital I/O Pin MSSP
23 RC5/SDO RC5 SDO Digital I/O Pin SPI Data-Out Pin
24 RC5 SD0 Digital I/O Pin MSSP
25 RC6 TX/CK Digital I/O Pin USART
26 RC7 RX/DT Digital I/O Pin USART
19 RD0 Digital I/O Pin
20 RD1 Digital I/O Pin
21 RD2 Digital I/O Pin
22 RD3 Digital I/O Pin
27 RD4 Digital I/O Pin
28 RD5 P1B Digital I/O Pin ECCP
29 RD6 P1C Digital I/O Pin ECCP
30 RD7 P1D Digital I/O Pin ECCP
8 RE0 AN5 Digital I/O Pin Analog Pin
9 RE1 AN6 Digital I/O Pin Analog Pin
10 RE2 AN7 Digital I/O Pin Analog Pin
13 RA7 OSC1 CLKIN Crystal Oscillator Input Pin
14 RA6 OSC2 CLKOUT Crystal Oscillator Output Pin
1 RE3 MCLR VPP ICSP Programming Enable Pin Master Clear Active Low Reset Pin
11,32 VDD Voltage Supply Pin
12,31 VSS Ground Pin

2. PIC16F887 Features

You can anticipate the nature of any device by looking at its main features. Following table shows the complete features of PIC16F887.
PIC16F887 Features
No. of Pins 40
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 8K
Program Memory (Instructions) 8192
RAM 368 Bytes
EEPROM 256 Bytes
ADC 10-Bit
I/O Ports (5) I/O Pins A,B,C,D,E 35
Packages 40-pin PDIP 44-pin QFN 44-pin TQFP
External Oscillator up to 20 MHz
Timer (3) 16-Bit Timer (1) 8-Bit Timer (2)
USART Protocol 1
I2C Protocol Yes
SPI Protocol Yes
Brown-out Reset Yes
Watchdog Timer Yes
Comparators 2
Master Synchronous Serial Port (MSSP) module 1
Capture/Compare/PWM 16bit/16bit/10bit
Power Saving Sleep Mode Yes
Selectable Oscillator Option Yes
Operating Current 11uA at 32 kHz, 2.0 V 220uA at 4 MHz, 2.0 V
Temperature Range -40 to 125
Oscillator Start-up Timer Yes
  • Checking main features before purchasing of the controller will help you analyze and develop your required project.
  • Power on reset and selectable oscillator options are some unique features included in the chip.

3. PIC16F887 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 PIC16F887.
Timer
PIC16F887 contains one 16-bit timer and two 8-bit timers that can be used in both ways i.e. timer and counter and comes with internal and external clock select capability. The timer mode is used to increment the instruction cycle while counter mode increments the rising and falling edge of the pin. When the bit T0CS (OPTION_REG<5>) is set, the counter mode will be selected and when it is cleared, the timer mode will be selected.
Brown Out Reset (BOR)
The BOR is a function that brings the controller to reset once the Vdd (voltage supply) drops below a brownout threshold voltage. There is a fine line between a BOR and Power On Reset, where the whole range of voltages is provided to protect the chip once the power drops at the voltage supply line. In order to put the delay, mostly recommended, in returning from a BOR function, the Power Up Timer must be kept enabled. Apart from controlling through software, the BOR mode can also be handled and configured through BOREN settings in a register.
USART
PIC16F887 comes with enhanced USART module. This module consists of TX - A transmission pin used for transmitting serial data to other devices and RX - A receive pin used for receiving serial data.
Watchdog Timer
PIC16F887 comes with built-in watchdog timer that is mainly used to reset the controller when a program hangs up during compilation or gets stuck in the infinite loop of the program. It is important to note the timer must be reset to the initial value after every 3 instructions in order to avoid it going to zero value in normal conditions. The watchdog timer is nothing but a countdown timer and starts from 1000 and gradually goes down to zero.
Power On Reset
Power On Reset function resets the controller when it is powered on. If there comes unknown error in the chip, powering on the device will exclude it from the loop of running program and saves the device from malfunctioning.
Sleep Mode
Power saving sleep function generates a low current power down mode. This sleep mode can be terminated using an interrupt, watchdog timer or external reset.

4. PIC Compiler

  • Microchip has introduced its own standard compiler for the PIC controller called MPLAB C18 Compiler. You can download this compiler online from the Microchip Official Site.
  • The code written in the compiler creates a hex file that is transferred to the microcontroller to execute the certain function.
  • Third party softwares are also available for compiling the program and MikroC Pro For PIC is mainly used for this purpose.
  • These Top 3 PIC C Compilers give you the flexibility to pick any compiler based on your needs and requirements.
  • The PICKit3 is mainly used for burning the code in the controller which is a standard PIC burner. There are other unofficial burners also available but PICKit3 is mostly preferred for the PIC controllers.

5. PIC16F887 Memory Layout and Working

The whole memory in this controller is distributed into three main types known as EEPROM, RAM and ROM Memory. All of them plays a vital role in the controller in terms of executing and calling instructions with some exceptions. Let's discuss each of them one by one.
ROM Memory
ROM memory, also known as Non-Volatile memory, which stores the running program permanently and is not dependent on the power supply i.e. has an ability to retain the program if the power supply is removed. The ROM memory is about 8K made with FLASH Technology.
EEPROM Memory
This memory is quite similar to ROM memory in one way or the other in terms of storing running program permanently with the exception i.e. the instructions in EEPROM can be modified during the operation of the controller. It contains memory space around 256 bytes, quite less than ROM memory, but enough to store the program permanently.
RAM Memory
RAM memory, also known as volatile memory, is divided into two main parts known as general-purpose registers (GPR) and special-function registers (SFR). This memory is volatile in nature as it stores the program temporarily and is power dependent i.e. once the power supply is turned off the instructions stored in the RAM will be removed.
  • Registers in the RAM memory are the data holding places in the controller. A single register can hold instruction, storage address, and any kind of data including bit sequence or individual characters.
Registers are classified into two banks called Bank 1 and Bank 2 where registers from 00H to 0BH and 80H to 8BH fall under the category of SFRs and remaining are GPRs.
  • Each bank contains128 bytes of memory space where first 12 locations are reserved for SFR while remaining are reserved for GPR.
Let’s discuss few registers in details. STATUS. This register plays a role to switch between the banks. Setting fifth bit of this register shows we are discussing bank 1 while resetting it will indicate we are discussing bank 0. TRISA. This register is used to configure PORTA as an input or output. The value 1 shows output and value 0 shows input. TRISB. This register is identical to the TRISA in terms of deciding the pins as an input or output and used for PORTB. W Register. All registers mentioned above are SFRs while W register is a GPR. It is not a part of any register bank and is accessible by the program only. The desired values are written on W register and transferred to the target register before writing them on the PORTA or PORTB.

6. PIC16F887 Block Diagram

The following figure shows the block diagram of PIC16F887.
  • The program memory comes with 8K memory space which can configure 8192 words.
  • Some pins can be interfaced with other functions of multiple devices including external interrupt, Timer0 clock input and Change on PORTB interrupt.

7. PIC16F887 Projects and Applications

  • PIC16F887 is mainly used in students project i.e. controlling motors and sensor interfacing.
  • Used in Central heating projects
  • Production of temperature data logger
  • Serial Communication
  • Used in health and security systems
  • Gas sensor projects
  • Embedded system
  • Used in industrial automation

8. Why Use PIC MicroControllers

PIC microcontrollers are widely used in most of the electronic applications because they offer easy to use interface that requires no prior skills for getting a hands-on experience with the module. These controllers are cheap and come with an ability to perform a number of functions using minimum circuitry. PIC controllers have outperformed Atmel controller like 8051 in terms of their efficiency and higher processing speed. More often than not, automation industries prefer and use these controllers for carrying out different operations as they offer very little power consumption. That’s all for today. I hope I have given you everything related to PIC16F887. If you are unsure or have any query, you can ask me in the comment section below. I’d love to help you in any way I can. You are most welcome to give your feedback and suggestions, they help us provide you quality work as per your needs and demands. Thanks for reading the article.

Introduction to PIC16F84a

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.
  • 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
  • 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. 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.
  • 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.

Introduction to PIC16F628a

Hi Fellas! I am back to give you have a daily dose of valuable information so you keep coming back for what we have to offer. Today, I will discuss the details on the Introduction to PIC16F628a. It is defined as a self-contained 18-pin PIC Microcontroller that comes with memory, processor, peripherals and mainly used for embedded systems and applications. Microcontrollers always remain a top priority for experts where automation is the main concern. Before the invention of microcontrollers, microprocessors were widely used for carrying out different functions related to industrial automation and processing applications. Both of them work identical in one way or the other, however, there are some exceptions i.e. microprocessors don't come with ROM, RAM, and other peripherals, we need to add them externally to make them function like a microcontroller, however, microcontroller comes with all peripherals on the single chip, we don't need to add them externally; that is what makes it compact as compared to a microprocessor that is bulky. I this tutorial, I'll discuss each and everything related to PIC16F628a, its main features, pinout, working, and applications. Let's jump right in and nail down everything you need to know.

Introduction to PIC16F628a

  • PIC16F628a is an 18-pin tiny chip that contains processor, memory, I/O pins, other peripherals and mainly used for the embedded system, and in the applications that have a remote or direct connection with the automation.
  • It is a low cost, high performance, CMOS Flash-based 8-bit microcontroller and is equally compatible with PIC16F628, PIC16C5X, PIC16C62XA and PIC12CXXX devices.
  • The PIC16F628a comes with 128 bytes of EEPROM data memory, 4MHz internal oscillator, two 8-bit and one 16-bit timer, USART, PWM, two comparators and programmable low voltage reference that make it suitable for appliances, automotive, industrial and consumer applications.
  • The PIC processor is based on advanced RISC architecture and comes with 35 instruction set that is simple to use and easy to configure.
  • Like some controllers in the PIC community, the PIC16F628a features operating range around 2 to 5.5 V where the temperature range is -40 to 125 °C.
  • Programmable memory size is 3.5 KB and SRAM is 224 bytes.
  • This PIC model is capable of storing 2048 words of program memory so maximum program length can't exceed from 2048 instructions where each word defines a single instruction.
  • Four clock cycles are needed to execute each instruction except jump and conditional instructions that may require 8 clock cycles.
PIC16F628a Pinout
Following figure shows the pinout of PIC16F628a.
  • Looking at the pinout of the controller above, you can clearly anticipate most of the pins on the left side can be used for multiple purposes, however, specifying any pin for particular function rules out the use of that pin for another purpose.
  • There are two ports in this model known as Port A and Port B.
  • All these pins are bidirectional I/O pins except Pin # 14 & Pin # 5 that are supply voltage and ground pins respectively.
  • Pin # 7 & Pin # 8 are used for a serial communication where Rx is a USART receive pin, used for receiving the serial data while Tx is a USART transmit pin, used for sending the serial data.
  • Pin # 4 can be used in three ways.e. MCLR (Master Clear) that requires a constant supply of 5V and must not exceed Vdd. When configured as MCLR, this pin behaves as an active low Reset to the device. It is also used as an input port and programming voltage input.
  • Pin # 15 & 16 are known as OSC2 (Oscillator 2) and OSC1 (Oscillator 1), where we can attach an external oscillator of around 20MHz. The Pin # 16 is an input for the crystal oscillator and Pin # 15 acts like an output for the oscillator.
  • Both Pin # 2 and Pin # 3 are the analog comparator pins where Pin # 3 is also used as a clock input for Timer0.
  • Pin # 6 is a bidirectional I/O pin that can be used for an external interrupt.
  • Pin # 9 is used for capture, compare and PWM and can be software programmed.
  • Pin#10 is a low voltage programming input pin and can also be used for interrupt-on-pin change. It is important to note that when low voltage programming is configured, then both "weak pull-up resistors and interrupt-on-pin change" are disabled.
  • If you are new to microcontrollers and feel difficulty in finding the right approach to get the hands-on experience with controller then you can have a look at Introduction to Microcontrollers where I have laid out everything you need to know and with little effort you can become pretty nifty about controller and streamline real-time projects as per your needs and requirements.
Memory Layout  
  • The memory layout is a little bit different where each memory location is considered as a register that can be accessed by its address.
  • It is important to note that, not all register are available all the time, and memory is laid out in four banks that come with 128 registers and only one back can be accessed at a given time.
  • The first 32 registers in each bank are known as special purpose registers that can be used to control the processor and I/O pins. The last 16 registers available in each bank are shared across all banks whose values can be accessed any time without depending on the specific bank being used.
  • There exists a single working register known as "W" that is mainly used to store the modified values of the different function being used in the controller.
  • The memory capacity of this model is little less than other controllers available in the market, however, you can compile a function that requires minimum instructions and processing speed. If you intend to work with high processing speed and more memory, then you need to consider working with PIC16F877a.

Main Features

This model of PIC controller is very useful for embedded projects and comes with some valuable features that put this advice ahead of many controllers in the PIC community.
Special Microcontroller Features
  • Low voltage programming that programs the chip using the operating voltage of the device
  • Low-speed Clock mode
  • Programmable Brown-Out Reset (BOR)
  • Power-on Reset
  • Watchdog Timer with an independent Oscillator for reliable operation
  • Selectable Oscillator Options
  • Programmable code protection
  • Multiplexed Master Clear/Input-pin
  • Industrial temperature range
I/O and Packages
  • 15 I/O pins with individual direction control
  • 18-pin DIP & SMD Package
High-Performance RISC CPU
  • Only 35 single word instructions to learn
  • All instructions are a single cycle (1µs) except for program branches
  • Operate at 20MHz with an external oscillator
  • 4MHz internal oscillator that gives a clock at a certain frequency using constant voltage. It can be made to work at 48 KHz for power saving and debugging purpose
  • 2 KB Flash Program Memory
  • 224 Byte RAM Memory
  • 128 Bytes of EEPROM
  • In-circuit Serial Programming
  • 1,000,000 write EEPROM endurance
  • 100,000 write Flash Endurance
  • Oscillator Start-up and Power-up Timer
  • Wide operating voltage range around 2 to 5.5 V
Peripheral Features
  • Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
  • One 16 bit timer/counter
  • Two 8-bit timer/counter(TMR0,TMR2)
  • Capture/Compare PWM (CCP) Module
  • High current source/sink for direct LED drive
  • Two Analog Comparators
  • Programmable weak pull-ups on PORTB
CMOS Technology
  • High-speed CMOS FLASH technology
  • Fully Static Design
  • Power-saving Sleep Mode
  • 40-year Data Retention
  • High-Endurance Flash Cell
  • Programmable VREF
PIC16F628a Compiler
  •  MPLAB C18 Compiler is the standard compiler used for PIC microcontrollers. You can get this compiler online from the Microchip Official Site.
  • Third party applications are also available for compiling the program where MikroC Pro For PIC stays ahead from other compilers available in the market.
  • You must check this list of Top 3 PIC C Compilers where you can pick any compiler based on your needs and requirements.
  • The code is written in PIC Compiler that compiles the code and generates a hex file that is uploaded on the PIC Microcontroller.
Applications
  • Mainly used in embedded system
  • Industrial automation and processing applications
  • Home automation and security systems
  • Data Processing Units
  • Robotics
That's all for today, I hope I have provided you everything you need to know related to this controller. If you are unsure or have any question, you can ask me in the comment section below. I'd love to help you in any way I can. Feel free to keep us updated with your valuable suggestion, they help us provide you a quality work. Thanks for reading the article.
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir