PIC16F877A
-
Upload
bhaskar-rao-p -
Category
Documents
-
view
12 -
download
0
description
Transcript of PIC16F877A
PIC is a family of Harvard architecture microcontrollers made by Microchip
Technology, derived from the PIC1650 originally developed by General
Instrument's Microelectronics Division. The name PIC initially referred to
"Peripheral Interface Controller".
PICs are popular with both industrial developers and hobbyists alike due to
their low cost, wide availability, large user base, extensive collection of
application notes, availability of low cost or free development tools, and
serial programming (and re-programming with flash memory) capability.
Microchip announced on September 2011 the shipment of its ten billionth
PIC processor.
PIC16F877A is a latest Enhanced Flash Microcontrollers From Microchip.
The Key Features are
The Device has its Internal Architecture as shown in the Block Diagram
Below.
PIC16F877A is very popular because of its affordable price. Apart from that
it is also very easy to be assembled. Additional components that you need to
make this IC work are just a 5V power supply adapter, a
20MHz crystal oscillator and 2 units of 22pF capacitors.
Special Microcontroller Features
- 100,000 erase/write cycle Enhanced Flash program memory typical
- Self-reprogrammable under software control
- Single-supply 5V In-Circuit Serial Programming
- Watchdog Timer (WDT) with its own on-chip RC oscillatpr
- Programmable Code Protection
- Power-Saving Sleeping mode
Peripheral Features
- Two 8-bit (TMR0, TMR2)timer/counter with Prescalar
- One 16-bit timer/counter
- Brown-out detection circuitry
- Parallel Slave Port (PSP): 40/44 pin-device only
High-Performance RISC CPU
- Only 35 single-word instructions to learn
- DC-20MHz clock input
- Up to 8K x 14 words of Flash Program Memory
- Pinout Compatible to other 28-pin or 40/44-pin
Analog Features
- 10-bit, up to 8-channel Analog-to-Digital Converter (A/D)
- Brown-out Reset(BOR)
- Two analog comparators
- Programmable on-chip voltage reference (VREF) module
CMOS Technology
- Low-power, high-speed Flsh/EEPROM technology
- Fully ststic design
- Wide operating voltage range (2.0V to 5.5V)
- Low-power consumption
Pin Description
Pin Number Description
1 MCLR/VPP
Pin Layout
2 RA0/AN0
3 RA1/AN1
4RA2/AN2/VREF-/
CVREF
5 RA3/AN3/VREF+
6 RA4/T0CKI/C1OUT
7 RA5/AN4/SS/C2OUT
8 RE0/RD/AN5
9 RE1/WR/AN6
10 RE2/CS/AN7
11 VDD
12 VSS
13 OSC1/CLKI
14 OSC2/CLKO
15 RC0/T1OSO/T1CKI
16 RC1/T1OSI/CCP2
17 RC2/CCP1
18 RC3/SCK/SCL
19 RD0/PSP0
20 RD1/PSP1
21 RD2/PSP2
22 RD3/PSP3
23 RC4/SDI/SDA
24 RC5/SDO
25 RC6/TX/CK
26 RC7/RX/DT
27 RD4/PSP4
28 RD5/PSP5
29 RD6/PSP6
30 RD7/PSP7
31 VSS
32 VDD
33 RB0/INT
34 RB1
35 RB2
36 RB3/PGM
37 RB4
38 RB5
39 RB6/PGC
40 RB7/PGD
All PIC16F87XA devices have a host of features intended to maximize
system reliability, minimize cost through elimination of external
components, providepower saving operating modes and offer code
protection. These are:
• Oscillator Selection
• Reset
- Power-on Reset (POR)
- Power-up Timer (PWRT)
- Oscillator Start-up Timer (OST)
- Brown-out Reset (BOR)
• Interrupts
• Watchdog Timer (WDT)
• Sleep
• Code Protection
• ID Locations
• In-Circuit Serial Programming
• Low-Voltage In-Circuit Serial Programming
• In-Circuit Debugger
PIC16F87XA devices have a Watchdog Timer which can be shut-off only
through configuration bits. It runs off its own RC oscillator for added
reliability.
There are two timers that offer necessary delays on power-up. One is the
Oscillator Start-up Timer (OST), intended to keep the chip in Reset until the
crystal oscillator is stable. The other is the Power-up Timer (PWRT), which
provides a fixed delay of 72 ms (nominal) on power-up only. It is designed
to keep the part in Reset while the power supply stabilizes. With these two
timers on-chip, most applications need no external Reset circuitry
Sleep mode is designed to offer a very low current power-down mode. The
user can wake-up from Sleep through external Reset, Watchdog Timer
wake-up or through an interrupt.
Several oscillator options are also made available to allow the part to fit the
application. The RC oscillator option saves system cost while the LP crystal
option saves power. A set of configuration bits is used to select various
options.
MEMORY ORGANIZATION
There are three memory blocks in each of the PIC16F87XA devices. The
program memory and data memory have separate buses so that concurrent
access can occur and is detailed in this section.
The PIC16F87XA devices have a 13-bit program counter capable of
addressing an 8K word x 14 bit program memory space. The
PIC16F876A/877A devices have 8K words x 14 bits of Flash program
Memory.
PROGRAM MEMORY
Data Memory Organization
The data memory is partitioned into multiple banks which contain the
General Purpose Registers and the Special Function Registers. Bits RP1
(Status<6>) and RP0 (Status<5>) are the bank select bits.
Each bank extends up to 7Fh (128 bytes). The lower locations of each bank
are reserved for the Special Function Registers. Above the Special Function
Registersare General Purpose Registers, implemented as static RAM. All
implemented banks contain Special Function Registers. Some frequently
used Special Function Registers from one bank may be mirrored in
another bank for code reduction and quicker access.
Simple steps to Program PIC16F877A
First assemble the PIC16F877A circuit with the 5V power supply, 20MHz
crystal oscillator and two 22pF capacitors. If you only have 12 volt power
supply adapter, you need a 5V voltage regulator circuit. You can build 5V
voltage regulator circuit using 7805 IC, IN4007 diode and two 10uF
capacitors.
Download and install free C compiler for PIC16F877A from Microchip
which is free. Copy the C program example to blink LED. Compile the
program using CCS C compiler. The hex file for this program will be
created after success compiling. This hex file needs to be loaded into the
PIC16F877A.
What is MPLAB?
MPLAB is free software that is needed to burn hex file into PIC16F877A
program memory. Download MPLAB IDE from Microchip which is free.
Install and run it. Connect PICStartPlus programmer using rs232 cable with
you PC. Position the PIC16F877A chip onto the PICStartPlus programmer.
Follow MPLAB instruction to burn the hex file into PIC16F877A chip.
Once complete, remove PIC16F877A from PICStartPlus and insert it onto
the development board. Turn ON the 5V power supply and see what happen.
Two more component needed are LED and resistor.
What is PICStartPlus?
PICStartPlus is a hardware pragrammer that is used to burn hex file into
PIC16F877A. PICStartPlus consist of power supply socket and cable, rs232
cable that should be connected to PC and a 40 pin ZIF socket. PIC16F877A
chip should be placed onto the ZIF socket.