yankee
- 9th February 2006, 14:45
OK, I'm stumped. I know I missed something stupid here and I need some insight.
I have an N.O. switch on gpio5 with a pullup resistor which is supposed to toggle an LED on gpio0. Nothing happens, however when I configure the code for a 16f628a, it works fine. I also checked the IC by loading a simple blink program and that works fine.
Oscillator is set to INTOSC
Watchdog enabled
Power-up enabled
MCLR as input
Brownout disabled
Here's the code:
cmcon = 7
trisio.5 = 1 ' port5 is an input
led1_status var bit
button1 var gpio.5
led1 var gpio.0
main:
sleep 1 ' sleep for about 1 second
if button1 = 0 then ' if the button is pressed
if led1_status = 1 then ' if its last state was 1
led1_status = 0 ' make it 0
low led1
pause 500 'debounce
else
led1_status = 1 ' the last state was a 0 so now make it a 1
high led1
pause 500 'debounce
endif
endif
I have an N.O. switch on gpio5 with a pullup resistor which is supposed to toggle an LED on gpio0. Nothing happens, however when I configure the code for a 16f628a, it works fine. I also checked the IC by loading a simple blink program and that works fine.
Oscillator is set to INTOSC
Watchdog enabled
Power-up enabled
MCLR as input
Brownout disabled
Here's the code:
cmcon = 7
trisio.5 = 1 ' port5 is an input
led1_status var bit
button1 var gpio.5
led1 var gpio.0
main:
sleep 1 ' sleep for about 1 second
if button1 = 0 then ' if the button is pressed
if led1_status = 1 then ' if its last state was 1
led1_status = 0 ' make it 0
low led1
pause 500 'debounce
else
led1_status = 1 ' the last state was a 0 so now make it a 1
high led1
pause 500 'debounce
endif
endif