currently i using a PIC 16f877a to control my LED from a switch . i have make 1 switch to control over my 5 LED .
my problem is i not sure which oscillator to use and i have try the RC Oscillator without using any crystal and it work. but with a random timing delay and not work on time .
once i use other Oscillator like HS Oscillator with 20 MHz connected to my PIC it work with fast speed all LED blinking . which i just want the LED on once i switch on and off once i switch off
my code is as below
void main()
{
while(1)
{
if ((!input(pin_a0)) == 0)
{
Output_high(pin_c0);
Output_high(pin_c1);
Output_high(pin_c2);
Output_high(pin_c3);
output_high(pin_c4);
Output_low(pin_c5);
}
if((input(pin_a0)) ==0)
{
output_low(pin_c0);
output_low(pin_c1);
output_low(pin_c2);
output_low(pin_c3);
output_low(pin_c4);
Output_high(pin_c5);
}
}
}
thank you .