PIC16F886 – 8 Bit Microcontroller
PIC16F886 is microcontroller from ‘PIC16F’ family and is made by MICROCHIP TECHNOLOGY. It is an 8-Bit CMOS Microcontroller with nano-Watt Technology. This microcontroller is popular among hobbyists and engineers due its features and cost.
PIC16F886 Pin Configuration
PIC16F886 is a 28 pin IC and each pin can perform multiple functions as shown in above PIC16F886 pin diagram. The description for each of these pins is given below.
Pin Number |
Pin Name |
Description |
1 |
RE3/MCLR/VPP |
RE3: Pin3 of Port E MCLR: Master Clear Input or Reset pin VPP: Programming voltage |
2 |
RA0/AN0/ULPWU/C12IN0- |
RA0: Pin0 of Port A AN0: Analog input 0 ULPWU: Ultra Low-Power Wake-up input C12IN0-: Comparator C1 or C2 negative input |
3 |
RA1/AN1/C12IN1- |
RA1: Pin1 of Port A AN1: Analog input 1 C12IN1-: Comparator C1 or C2 negative input |
4 |
RA2/AN2/VREF-/CVREF/C2IN+ |
RA2: Pin2 of Port A AN2: Analog input 2 VREF-: A/D reference voltage (low) input CVREF: Comparator voltage reference output C2IN+: Comparator C2 positive input |
5 |
RA3/AN3/VREF+/C1IN+ |
RA3: Pin3 of Port A AN3: Analog input 3 VREF+: A/D reference voltage (high) input C1IN+: Comparator C1 positive input |
6 |
RA4/T0CKI/C1OUT |
RA4: Pin4 of Port A T0CKI: Timer0 external clock input C1OUT: Comparator C1 output |
7 |
RA5/AN4/SS/ C2OUT |
RA5: Pin5 of Port A AN4: Analog input 4 SS: SPI slave select input C2OUT: Comparator C2 output |
8 |
VSS |
Ground |
9 |
RA7/OSC1/CLKIN |
RA7: Pin7 of Port A OSC1:Oscillator pin 1 CLKI: External clock source input |
10 |
RA6/OSC2/CLKOUT |
RA6: Pin6 of Port A OSC2: Oscillator pin 2 CLKO: Clock source output |
11 |
RC0/T1OSO/T1CKI |
RC0: Pin0 of Port C T1OSO :Timer1 oscillator output T1CKI: Timer1 external clock input |
12 |
RC1/T1OSI/CCP2 |
RC1: Pin1 of Port C T1OSI: Timer1 oscillator input CCP2:Capture 2 input/Compare 2 output/PWM2 output |
13 |
RC2/P1A/CCP1 |
RC2: Pin2 of Port C P1A: PWM output CCP1: Capture 1 input/Compare 1 output/PWM1 output. |
14 |
RC3/SCK/SCL |
RC3: Pin3 of Port C SCK: SPI clock SCL: I2C clock |
15 |
RC4/SDI/SDA |
RC4: Pin4 of Port C SDI: SPI data input SDA: I2C data I/O |
16 |
RC5/SDO |
RC5: Pin5 of Port C SDO: SPI data out |
17 |
RC6/TX/CK |
RC6: Pin6 of Port C TX: EUSART asynchronous transmit CK: EUSART synchronous clock |
18 |
RC7/RX/DT |
RC7: Pin7 of Port C RX: EUSART asynchronous receive DT: EUSART synchronous data |
19 |
VSS |
Ground |
20 |
VDD |
Positive Power Supply |
21 |
RB0/AN12/INT |
RB0: Pin0 of Port B AN12: Analog input 12 INT: External interrupt |
22 |
RB1/AN10/P1C/C12IN3- |
RB1: Pin1 of Port B AN10: Analog input 10 P1W: PWM output C12IN3-: Comparator C1 or C2 negative input |
23 |
RB2/AN8/P1B |
RB2: Pin2 of Port B AN8: Analog input 8 P1B: PWM output |
24 |
RB3/AN9/PGM/C12IN2- |
RB3: Pin3 of Port B AN9: Analog input 9 PGM: Low-voltage ICSP Programming enable pin C12IN2-: Comparator C1 or C2 negative input |
25 |
RB4/AN11/P1D |
RB4: Pin4 of Port B AN11: Analog input 11 P1D: PWM output |
26 |
RB5/AN13/T1G |
RB5 Pin5 of Port B AN13: Analog input 13 T1G: Timer1 Gate input |
27 |
RB6/ICSPCLK |
RB6: Pin6 of Port B ICSPCLK: Serial Programming Clock |
28 |
RB7/ICSPDAT |
RB7: Pin7 of Port B ICSPDAT: ICSP Data I/O |
PIC16F886 Features
CPU |
8-bit |
Total pins |
28 |
Programmable pins |
24 |
Communication Interface |
SPI Serial Interface(7,14,15,16 PINS) [Can be used for programming this controller] UART Interface(17,18 PINS) [Can be used for programming this controller] Two-wire Serial Interface or I2C(14,15 PINS) [Can be used to connect sensors and LCDs] ICSP or In-Circuit Serial Programming Interface (27,28 Pins) [Can be used for programming this controller] |
ADC Feature |
11channels of 10-bit resolution |
Timer Feature |
One 8-bit counter, Two 16-bit counter |
Analog Comparators |
2 |
PWM channels |
4 |
External Oscillator |
Up to 20MHz |
Internal Oscillator |
31KHz-8MHz Internal R-C Oscillator featured with:
|
Program memory / Flash memory |
16Kbytes[100000 write/erase cycles] |
CPU Speed |
1MIPS @ 1MHz |
RAM |
368Bytes |
EEPROM |
256Bytes |
Watchdog Timer |
Programmable Watchdog Timer with separate on-chip oscillator |
Power Save Modes |
Available |
Operating Voltage |
2.0V to 5.5V |
Maximum current to any I/O pin |
IN :25mA OUT : 25mA |
Operating Temperature |
-40°C to +125°C |
PIC16F886 Replacements
PIC16F882 and PIC16F883
PIC16F886 Microcontroller Overview
PIC16F886 is a microcontroller good for experimenting and developing applications because it has high flash memory rewrite cycle. Also there are a lot of tutorials and support available online. The controller has 16KBytes flash memory which is enough for many applications. Along with 24 programmable Input/output pins which are developed to handle 20mA current (direct LED driving capability) the system can interface many peripherals easily. With Watchdog timer to reset under error automatically the controller can be used to develop applications of permanent installation.
How to Use PIC16F886 Microcontroller
Like any other microcontroller, PIC16F886 needed to be programmed before getting the chip working. So for working of PIC16F886, first we need to save the appropriate program file in the controller FLASH memory. Once power is provided, the controller executes this code saved in FLASH memory to create the response.
Entire process of programming PIC16F886 goes like this:
- First list all the functions to be executed by this controller.
- Next write these functions in ‘IDE software’ using relative programming language
(MPLAB IDE for Windows OS [www.microchip.com/mplabx-ide-windows-installer ])
(For these MPLAB IDE you can use ‘C’ language to write the application program)
- After writing the desired program compile it for error elimination
- For a successful compilation IDE application generates HEX file for the written program
- Choose the programming device (usually ‘PIC kit 3’ or ‘PIC kit 2’) which establishes communication between PC and PIC16F886
- Connect the programming device to microcontroller appropriately
- Run the HEX file dumping software which is related to the chosen programming device
- Choose the appropriate program HEX file and burn this HEX file in PIC16F886 flash memory
- Disconnect the programmer and connect the appropriate peripherals for the controller
After connecting the power, the controller executes this HEX code saved in the memory (which is written program) and creates response as instructed.
Applications
- Hobbyist projects
- Display units
- Development board for learners
- Analog signal measuring and manipulations
- Embedded systems like coffee machine, vending machine
- Motor control systems
2D Model