It may not be the most structured of codes, but this also demonstrates the IF...Then...Else option
I think your original problem was in setting the PIC up as digital and turning off the analogue functions, hence the ANSEL and CMCON settingsCode:@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON ANSEL=0 CMCON=7 TRISIO = %101010 LED var GPIO.0 main: IF GPIO.1=0 THEN goto flash ELSE LED=0 ENDIF goto main: Flash: LED=1 If GPIO.1=1 then main: pause 100 LED=0 pause 100 goto flash:
Wow... I'm only a newbie and I've managed to pass on some advice... maybe my status should change from newbie to novice![]()
![]()




Bookmarks