
I have a noob question. i have been playing with this all night. Im using Microcode 3005 and PBP 2.46. Chip is 12F675. I have checked the usual...blinked the LED's using blink program as a test, and tested the button. All i get is: LED 1 stays on. Schematic is similar to the one above 'cept RC osc, different chip of course.
Code:
CMCON = $1F
CMCON = %00000111
GPIO = %00000001 ' Set GPIO 1 high to turn on LED1
TRISIO = %00000010 ' set GPIO 4-1 to INputs, RA0 OUTput
Main:
'*** Test the switch state ***
if GPIO.0 = 0 then led2 'If switch is pressed then jump to LED2 routine
GPIO.1 = 1 ' Turn LED1 on
GPIO.2 = 0 ' Turn LED2 off
goto Main ' Jump to the top of the main loop
LED2:
'*** Turn LED2 on ***
GPIO.2 = 1 ' LED2 on
GPIO.1 = 0 ' LED1 off
goto Main ' Jump to the top of the main loop
Any hints on how to troubleshoot this? I don't really want it re-written for me because i am trying to learn but i may change my mind later. thanks.
Bookmarks