Rich (BB code):
//Student Name:Ooi Wei Sheng
#include <pic.h>
/*Lab1.c - Turn ON PORT B 0 LED*/
__CONFIG(0x3f38);
void interrupt timer()
{
PORTA=1;
for(int i= 0; i<16;i++)
{
while(!T0IF);
T0IF=0;
TMR0=0;
}
PORTA=PORTA<<1;
}
main()
{
TRISA=0;
OPTION_REG =7;
GIE=7;
T0IE=1;
while(1);
}
this is the code given by my lecturer in order to blink the led for 1 second, but i was wandering, how the led blink ? since after the delay 1s loop which is a for loop looping for 15 times, the program requires the led to shift by 1 bit to the left, however, there is no more delay after shifting it to the left by one bit, doesnt it meant the LED in RA0 will light up forever since the bliking is too fast for our naked eye to detect? can someone explain it to me?