latch circuit?
wiresalot
Posts: 40
Is there away to create a latch/unlatch circuit in my program?
15 would = latch
and say 12 would = unlatch
thanks,
wiresalot
15 would = latch
and say 12 would = unlatch
' {$STAMP BS2} ' {$PBASIC 2.5} value VAR Word Main: DO HIGH 14 HIGH 2 PAUSE 100 RCTIME 2, 1, value ' measure rctime DEBUG DEC value, CR IF (value = 1 ) THEN ' evaluate duration DEBUG "alarm " : HIGH 15 ELSEIF (value = 0) THEN DEBUG "trouble" : LOW 14 :PAUSE 100: HIGH 14 :PAUSE 100 : LOW 14 ELSE DEBUG "normal " ENDIF DEBUG CR, CR PAUSE 100 LOW 15 LOOP
thanks,
wiresalot
Comments
If it was a flip flop latch I think you could make a simple addition to the program that would put 12 in the opposite state of 15. (if 15 =1 then 12 =0, if 15= 0 then 12 = 1)
If you need a latch to keep 15 high until 12 "unlatched" the circuit, if 15 goes high, you could drop to a sub-routine that keeps 15 high until it see a state change on 12. I used a subrountine like that on a self-calibrating bot once. 12 could be triggered by anything a button, a count-down, it's own RCTime calculation.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If you convince yourself that something is impossible before you even try; you are sure to prove yourself right.
The output register (OUTS) is a latch if that's what you really need.