Hi,
We are trying to program our PIC 16F88 so that we can time our LED when triggered by a switch. We want the LED to stay on for five seconds everytime the switch is turned on.
This is the code we have so far:
'---------------------
DEFINE OSC 20
TRISB = %00000000 'setup PORTB; 0 for output, 1 for input
TRISA.0=1
loop:
IF PORTA.0 = 1 Then ledon
PORTB.0=0 'turn off LED
GOTO loop
ledon:
PORTB.0=1 'light LED
PAUSE 5000 'pause for 2 seconds
PORTB.0=0 'turn off LED
GOTO loop
END
'------------------------------------------
We have connected the switch to port A0 and the led to port B0. We would appreciate any help.
Bookmarks