Ok, this would be for PicBasic Pro. Tested on an 877, but it should still work with a 628.
How you do it in Proton, I haven't got a clue.
HTH,Code:@ DEVICE WDT_OFF ; Disable Watch-Dog timer DEFINE OSC 4 LED VAR PORTB.1 StopPin VAR PORTB.0 INTEDG VAR OPTION_REG.6 ; 0 = falling edge, 1 = rising INTE VAR INTCON.4 ; External interrupt Enable bit INTF VAR INTCON.1 ; External interrupt Flag Delay VAR WORD INPUT StopPin ; Is already default, but just to make sure INTEDG = 0 ; Interrupt on falling edge INTE = 1 ; Enable External Interrupts Main: Toggle LED For Delay = 1 to 500 PAUSE 1 IF StopPin = 1 THEN LOW LED ; Turn OFF anything that will draw current INTF = 0 ; Clear the Interrupt Flag @ SLEEP ; enter Low Power mode GOTO MAIN endif NEXT Delay Goto Main




Bookmarks