Hi All
Having a bad morning here )
I've attached a wee bit of minimalist code to illustrate the problem. All I want it to do is on receipt of some non-synchronous serial data, fire the beeper every time that some serial data is received - I'm only sending ONE character for test purposes - not a string of chars and would expect it to fire once every time I send it a char.
What happens is that on receipt of the data, it interrupts, fires the beeper, waits a second (I've purposely put in a 1S pause), fires the beeper - ad nauseam !
I can't for the life of me see what's wrong with this
I can remove the setintflags (resetting the int flag for bit 5) from the interrupt - it fires once then remains silent for any subsequent serial reception as you would expect - replacing the setintflags causes the interrupt code to fire forever.
No doubt I've missed some important point in the proceedings LOL
TIA
Neil
#picaxe 28x2
symbol beeper = b.6
symbol nextButton = pinA.2 'Leg 4
init: hsersetup B9600_8, %001 '9600,8,N,1 - background receive on
setintflags %00100000,%00100000 'interrupt on receipt of data
low beeper
main: gosub waitButton
goto main
end
beep1: high beeper
pause 70
low beeper
return
waitButton: if nextButton = 0 then 'no debouncing - just wait ...
gosub beep1
return
else
goto waitButton
endif
interrupt: gosub beep1
pause 1000
setintflags %00100000,%00100000 're-enable the interrupt flag
return
Having a bad morning here )
I've attached a wee bit of minimalist code to illustrate the problem. All I want it to do is on receipt of some non-synchronous serial data, fire the beeper every time that some serial data is received - I'm only sending ONE character for test purposes - not a string of chars and would expect it to fire once every time I send it a char.
What happens is that on receipt of the data, it interrupts, fires the beeper, waits a second (I've purposely put in a 1S pause), fires the beeper - ad nauseam !
I can't for the life of me see what's wrong with this
I can remove the setintflags (resetting the int flag for bit 5) from the interrupt - it fires once then remains silent for any subsequent serial reception as you would expect - replacing the setintflags causes the interrupt code to fire forever.
No doubt I've missed some important point in the proceedings LOL
TIA
Neil
#picaxe 28x2
symbol beeper = b.6
symbol nextButton = pinA.2 'Leg 4
init: hsersetup B9600_8, %001 '9600,8,N,1 - background receive on
setintflags %00100000,%00100000 'interrupt on receipt of data
low beeper
main: gosub waitButton
goto main
end
beep1: high beeper
pause 70
low beeper
return
waitButton: if nextButton = 0 then 'no debouncing - just wait ...
gosub beep1
return
else
goto waitButton
endif
interrupt: gosub beep1
pause 1000
setintflags %00100000,%00100000 're-enable the interrupt flag
return