buzzlightyear
Member
I am reading 2 digital inputs, one of which is a reasonably fast continuous pulse, the other which is a state changing logic hi/lo, what I need to do is have the continuous pulse always send a serial event on every high and nothing when low, and the other pin will send a serial event for each state but only when the state changes, so if it is high it sends the high serial event once, then when the state changes to low it send the low serial event once. I kind of have it working, but because I am using a loop each time the loop restarts the pins are being read as expected but sending the message regardless of the last sent state. It is probably simple to do but I can't figure it out, timing is critical as this is to be used for midi clock generation. Here is my code
Code:
main:
IF rs_in = 0 THEN
hserout 0,(0xFc)
ENDIF
IF rs_in = 1 THEN
hserout 0,(0xFa)
ENDIF
IF clk_in= 1 THEN
hserout 0,(0xF8)
DO UNTIL clk_in =0
LOOP
ENDIF
GOTO main