Debounce timing
Turnbull2112
Posts: 65
I am reading an RCTIME and have a threshold set as a trip point. Example below.
DO
IF time > 5000 THEN
HIGH 5
LOW 6
ENDIF
IF time < 5000 THEN
LOW 5
HIGH 6
GOSUB flash
ENDIF
flash:
HIGH 7
PAUSE 200
LOW 7
PAUSE 200
HIGH 7
PAUSE 200
LOW 7
LOOP UNTIL time > 5000
RETURN
How would I build in a way to delay the trip point·if the process variable fluctuates under/over the setpoint? While maintaining the flasher? Adding hysteresis? Some deadband? Ideas? So far I just keep flickering on and off.
·
DO
IF time > 5000 THEN
HIGH 5
LOW 6
ENDIF
IF time < 5000 THEN
LOW 5
HIGH 6
GOSUB flash
ENDIF
flash:
HIGH 7
PAUSE 200
LOW 7
PAUSE 200
HIGH 7
PAUSE 200
LOW 7
LOOP UNTIL time > 5000
RETURN
How would I build in a way to delay the trip point·if the process variable fluctuates under/over the setpoint? While maintaining the flasher? Adding hysteresis? Some deadband? Ideas? So far I just keep flickering on and off.
·
Comments
I assume that is not a complete program, no? Both IF statements end up executing the flash routine, one because it simply drops through, and the second in a syntax warp of a GOSUB. Check the program flow.
Hysteresis can be arranged with the following kind of statement, which creates a one bit state variable, separate from the measurement itself
In the space between 4900 and 5100, the value of tripped retains a value that can be either 0 or 1, depending on the direction of trend.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!