Example by Bruce, 5-Jan-2010
Code: @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF DEFINE OSC 4 OSCCON = %01100000 ' 4MHz internal ANSEL = 0 ' Set portA outputs to Digital / No ADC CMCON0 = 7 ' comparators disabled PORTA = 0 TRISA = %00000001 ' RA0 input OPTION_REG.7 = 0 ' pull-up global enable WPUA = %00000001 ' pull-up enabled on RA0 include "DT_INTS-14.bas" include "ReEnterPBP.bas" ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler RAC_INT, _MyInt, PBP, yes endm INT_CREATE ; Creates the interrupt processor INT_ENABLE RAC_INT ; Enable RA change interrupt ENDASM WHILE !PORTA.0 ' read for wake up om change WEND IOCA.0=1 ' RA0 int-on-change enabled Main: TOGGLE PORTA.2 PAUSE 500 GOTO Main MyInt: WHILE !PORTA.0 WEND ' wait for button release TOGGLE PORTA.1 @ INT_RETURN
Page last modified on March 05, 2018, at 02:35 PM