Dear friends,
I am trying to design a basic traffic system using 16F877A and LEDs.
I can download the code to PIC16F877A using pickit3.
But only first LED which is connected to RA0 blinks. None other LEDs are blinking. All LED s are connected along with a 100 Ohm series resistor
Can anyone help?
I am trying to design a basic traffic system using 16F877A and LEDs.
Code:
#include <stdio.h>
#include <stdlib.h>
#define _XTAL_FREQ 2000000
#include <xc.h>
// BEGIN CONFIG
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
//END CONFIG
int main()
{
PORTA = 0x00;
TRISA = 0x00; //RA0 as Output PIN
while(1)
{
RA0 = 1;
__delay_ms(1000);
RA0 = 0;RA1 = 1;
__delay_ms(1000);
RA1 = 0;RA2 = 1;
__delay_ms(1000);
RA2 = 0;
}
return 0;
}
But only first LED which is connected to RA0 blinks. None other LEDs are blinking. All LED s are connected along with a 100 Ohm series resistor
Can anyone help?