I found a mistake, cmcon was the wrong address
ADCON0 = $1F
ADCON0 = %00000000 'TURN OFF CONVERTER
CMCON = $19 'MAKE PINS DIGITAL
CMCON = %00000111
GPIO = %00000001 ' Set GPIO 1 high to turn on LED1
TRISIO = %00000110 ' set GPIO 1 & 2 to INputs, GPIO 0 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
Bookmarks