Programming PIC16F877A
Programming PIC16F877A
Other programming language that can be used to program PIC16F877A are assembly language
(low level language), High-Tech C and PicBasic.
I/ O pins
There are 40 pins on PIC16F877A. Most of them can be used as an IO pin. Others are already for
specific functions. These are the pin functions.
1. MCLR – to reset the PIC
2. RA0 – port A pin 0
3. RA1 – port A pin 1
4. RA2 – port A pin 2
5. RA3 – port A pin 3
6. RA4 – port A pin 4
7. RA5 – port A pin 5
8. RE0 – port E pin 0
9. RE1 - port E pin 1
10. RE2 – port E pin 2
11. VDD – power supply
12. VSS – ground
13. OSC1 – connect to oscillator
14. OSC2 – connect to oscillator
15. RC0 – port C pin 0
16. RC1 – port C pin 0
17. RC2 – port C pin 0
18. RC3 – port C pin 0
19. RD0 - port D pin 0
20. RD1 - port D pin 1
21. RD2 - port D pin 2
22. RD3 - port D pin 3
23. RC4 - port C pin 4
24. RC5 - port C pin 5
25. RC6 - port C pin 6
26. RC7 - port C pin 7
27. RD4 - port D pin 4
28. RD5 - port D pin 5
29. RD6 - port D pin 6
30. RD7 - port D pin 7
31. VSS - ground
32. VDD – power supply
33. RB0 - port B pin 0
34. RB1 - port B pin 1
35. RB2 - port B pin 2
36. RB3 - port B pin 3
37. RB4 - port B pin 4
38. RB5 - port B pin 5
39. RB6 - port B pin 6
40. RB7 - port B pin 7
By utilizing all of this pin so many application can be done such as:
1. LCD – connect to Port B pin.
2. LED – connect to any pin declared as output.
3. Relay and Motor - connect to any pin declared as output.
4. External EEPROM – connect to I2C interface pin – RC3 and RC4 (SCL and SDA)
5. LDR, Potentiometer and sensor – connect to analogue input pin such as RA0.
6. GSM modem dial up modem – connect to RC6 and RC7 – the serial communication interface
using RS232 protocol.
For more detail function for each specific pin please refer to the device datasheet from
Microchip.