PIC16F877A LED blink

The Microchip PIC16F877A has 40 pins 33 of them can be input or output. In this simple project I am going to configure this microcontroller to blink a 33 LED each LED is connected to one I/O pin.
PIC16F877A LED blink
The PIC16F877A has 8 analog channels, so we have to configure all these channels as digital output.
The pin RA4 is an open drain output we must add a pull up resistor to turn it on and off.
The circuit schematic is shown by the following picture:
The code is written using MikroC PRO for PIC compiler:
 PIC16F877A LED blink Schematic
void main(){  ADCON1 = 0x07;          // Configure all analoge pins as digital  PORTA = ; TRISA = ;   // Configure PORTA as output  PORTB = ; TRISB = ;   // Configure PORTB as output  PORTC = ; TRISC = ;   // Configure PORTC as output  PORTD = ; TRISD = ;   // Configure PORTD as output
  PORTE = ; TRISE = ;   // Configure PORTE as output  while (1) {  PORTA = ~ PORTA;       // Invert PORTA status   PORTB = ~ PORTB;       // Invert PORTB status   PORTC = ~ PORTC;       // Invert PORTC status   PORTD = ~ PORTD;       // Invert PORTD status   PORTE = ~ PORTE;       // Invert PORTE status   delay_ms(500);   } }

For more detail: PIC16F877A LED blink

Current Project / Post can also be found using:

  • How to blink an led using pi16f877a with mikroc Pdf
  • led blink
READ  An LED Persistance Of Vision Name Badge using PIC16F88

Leave a Comment

= 3 + 6

Read previous post:
Weather Station
Weather Station

What is it? The Small Weather Station is a battery-operated, wireless, weather station. I have been working on the project...

Scroll to top