ISROnChange as a flag to change port pin output
Posted: Sun Mar 06, 2011 5:20 pm
I was trying to use a event handler to change the bit of to "action = 1"
Which works but i can't reset it to 0
Which works but i can't reset it to 0
Code: Select all
Device = 18F1220
Clock = 8
Config MCLRE = OFF 'Disable MCLR on Pin 4 (RA5)
// import modules...
Include "ISROnChange.bas"
Include "Utils.bas"
Dim action As Bit
// event handler...
Event OnChange()
action = 1
End Event
// program start...
SetAllDigital
SetRBMask($80) // only interested in PORTB.7 on change events
ISROnChange.Initialize(OnChange) // initialize the OnChange module, pass OnChange event handler
action = 0
// loop forever...
While true
action = 0
If action = 1 Then
High (PORTA.0)
DelayMS(1000)
ElseIf action = 0 Then
Low (PORTA.0)
EndIf
Wend