Friday, February 21, 2014

Pin Description

Input/output ports

       PIC16F877 has 5 basic input/output ports. They are usually denoted by PORT A (R A), PORT B (RB), PORT C (RC), PORT D (RD), and PORT E (RE). These ports are used for input/ output interfacing. In this controller, “PORT A” is only 6 bits wide (RA-0 to RA-7), ”PORT B” , “PORT C”,”PORT D” are only 8 bits wide (RB-0 to RB-7,RC-0 to RC-7,RD-0 to RD-7), ”PORT E” has only 3 bit wide (RE-0 to RE-7).

PORT-A RA-0 to RA-5 6 bit wide
PORT-B RB-0 to RB-7 8 bit wide
PORT-C RC-0 to RC-7 8 bit wide
PORT-D RD-0 to RD-7 8 bit wide
PORT-E RE-0 to RE-2 3 bit wid

      All these ports are bi-directional. The direction of the port is controlled by using TRIS(X) registers (TRIS A used to set the direction of PORT-A, TRIS B used to set the direction for PORT-B, etc.). Setting a TRIS(X) bit ‘1’ will set the corresponding PORT(X) bit as input. Clearing a TRIS(X) bit ‘0’ will set the corresponding PORT(X) bit as output.
(If we want to set PORT A as an input, just set TRIS(A) bit to logical ‘1’ and want to set PORT B as an output, just set the PORT B bits to logical ‘0’.)
o   Analog input port (AN0 TO AN7) : these ports are used for interfacing analog inputs.
o   TX and RX: These are the USART transmission and reception ports.
o   SCK: these pins are used for giving synchronous serial clock input.
o   SCL: these pins act as an output for both SPI and I2C modes.
o   DT: these are synchronous data terminals.
o   CK: synchronous clock input.
o   SD0: SPI data output (SPI Mode).
o   SD1: SPI Data input (SPI mode).
o   SDA: data input/output in I2C Mode.
o   CCP1 and CCP2: these are capture/compare/PWM modules.
o   OSC1: oscillator input/external clock.
o   OSC2: oscillator output/clock out.
o   MCLR: master clear pin (Active low reset).
o   Vpp: programming voltage input.
o   THV: High voltage test mode controlling.
o   Vref (+/-): reference voltage.
o   SS: Slave select for the synchronous serial port.
o   T0CK1: clock input to TIMER 0.
o   T1OSO: Timer 1 oscillator output.
o   T1OS1: Timer 1 oscillator input.
o   T1CK1: clock input to Timer 1.
o   PGD: Serial programming data.
o   PGC: serial programming clock.
o   PGM: Low Voltage Programming input.
o   INT: external interrupt.
o   RD: Read control for parallel slave port.
o   CS: Select control for parallel slave.
o   PSP0 to PSP7: Parallel slave port.
o   VDD: positive supply for logic and input pins.
o   VSS: Ground reference for logic and input/output pins.

Features of PIC16F877

Features of PIC16F877

The PIC16FXX series has more advanced and developed features when compared to its previous series. The important features of PIC16F877 series is given below.

General Features

o   High performance RISC CPU.
o   ONLY 35 simple word instructions.
o   All single cycle instructions except for program branches which are two cycles.
o   Operating speed: clock input (200MHz), instruction cycle (200nS).
o   Up to 368×8bit of RAM (data memory), 256×8 of EEPROM (data memory), 8k×14 of flash memory.
o   Pin out compatible to PIC 16C74B, PIC 16C76, PIC 16C77.
o   Eight level deep hardware stack.
o   Interrupt capability (up to 14 sources).
o   Different types of addressing modes (direct, Indirect, relative addressing modes).
o   Power on Reset (POR).
o   Power-Up Timer (PWRT) and oscillator start-up timer.
o   Low power- high speed CMOS flash/EEPROM.
o   Fully static design.
o   Wide operating voltage range (2.0 – 5.56)volts.
o   High sink/source current (25mA).
o   Commercial, industrial and extended temperature ranges.
o   Low power consumption (<0.6mA typical @3v-4MHz, 20µA typical @3v-32MHz and <1 A typical standby).

Peripheral Features

o   Timer 0: 8 bit timer/counter with pre-scalar.
o   Timer 1:16 bit timer/counter with pre-scalar.
o   Timer 2: 8 bit timer/counter with 8 bit period registers with pre-scalar and post-scalar.
o   Two Capture (16bit/12.5nS), Compare (16 bit/200nS), Pulse Width Modules (10bit).
o   10bit multi-channel A/D converter
o   Synchronous Serial Port (SSP) with SPI (master code) and I2C (master/slave).
o   Universal Synchronous Asynchronous Receiver Transmitter (USART) with 9 bit address detection.
o   Parallel Slave Port (PSP) 8 bit wide with external RD, WR and CS controls (40/46pin).
o   Brown Out circuitry for Brown-Out Reset (BOR).

Key Features

o   Maximum operating frequency is 20MHz.
o   Flash program memory (14 bit words), 8KB.
o   Data memory (bytes) is 368.
o   EEPROM data memory (bytes) is 256.
o   5 input/output ports.
o   3 timers.
o   2 CCP modules.
o   2 serial communication ports (MSSP, USART).
o   PSP parallel communication port
o   10bit A/D module (8 channels)

Analog Features

o   10bit, up to 8 channel A/D converter.
o   Brown Out Reset function.
o   Analog comparator module.

Special Features

o   100000 times erase/write cycle enhanced memory.
o   1000000 times erase/write cycle data EEPROM memory.
o   Self programmable under software control.
o   In-circuit serial programming and in-circuit debugging capability.
o   Single 5V,DC supply for circuit serial programming
o   WDT with its own RC oscillator for reliable operation.
o   Programmable code protection.
o   Power saving sleep modes.
o   Selectable oscillator options.
Reference:datasheet

Beginning To PIC16F877A

Pin Diagram :


Comparitive study on PIC16F87X based on key features

Reference: Datasheet

Comparison between different PIC series


why to use PIC

Using the 16F877A. ... The 16F877A is one of the most popular PIC microcontrollers.
              PIC is a family of modified 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"

        PIC® 's are microcontrollers. PIC® 's are a large range of microcontrollers manufactured by Microchip Technology Inc. The 8-bit range, also known as the PIC16 range is a popular microcontroller range for beginners and students. Especially the PIC16F84 and PIC16F877. There are many books available that help students with the basics of microcontrollers. I would recommend any beginner to start by using a book on PIC's like "PIC in Practice by D.W. SMITH" or many others like PIC Trix and so on. A complete book will guide you better through the learning stages than the bits and pieces on the internet. Internet will help you allot once you are more experienced.

         PIC16F84 does not support USART (Universal Synchronous Asynchronous Receiver Transmitter) therefore it cannot perform serial communications such as RS-232 (comport) communications unless very unconventional attempts are made to create it in firmware (software programmed into the chip) which I don't recommend.
          If you are a beginner and want to use PIC but also feel you want to extend your experiments to communications with a computer, other PIC's or serial IC's. Then I would recommend starting with PIC16F877 they may be intimidating at first, but after you studied its datasheet and learned some basic assembler or ANSI C, you can get started. For beginners I actually recommend assembler since it teach you more about the operation of the microcontroller in its core. I would recommend looking at www.microchip.com for the MPLAB program and search the net for MPASM compiler and ICprog programmer software (you need an extra driver for parallel port if you program via parallel port in win XP perhaps Vista as well). Unless you want to spend a fortune on programmer hardware you can build your own. a Tait style programmer may work well with ICprog, there are many circuits on the internet for this type of programmer.other microcontrollers are also available in the same level. There are MSC51 standard Atmel 89C51 or 8051 family and then there is Atmel AVR, like the ATMEGA8. The nice part about the ATMEGA8 for instance is that if you feel comfortable with this device and probably started using C language to make life easier. You find it very easy to move up to ATMEGA128 which is a more advance microcontroller. For AVR's there are a very resourceful website called http://www.avrfreaks.net/ go have a look.

The best approach to microcontrollers is not to commit your self to quickly to a particular one or brand name, "play the field a bit". Once you are more experienced it's best to use your experience and choose a nice microcontroller that can do most of what you will need and try stick with it or a very few variations at least. It takes very long to study and learn a particular make or model very well and you really do not want to go through all that every time you do a new project.

But to make your first MCU (micro controller unit) project a PIC project is not a bad idea due to all the basic educational resources and help available.

PIC is the series of microcontroller having some advance features then other series of microcontrollers like 8051. one is the speed that is fast in comparison and we can also interface usb through it.