BlackBamba
Member
A state machine solution
I think this can easily be modelled in a 5 states FSM?
Yes, it will be longer but it's just VERY clear what's going on in each step and it's easy to make it safe (delays are active even when RUN is off).
In Psudo code:
(of course, you'll have to handle the state changes via integer var/register, or state bits).
I think this can easily be modelled in a 5 states FSM?
Yes, it will be longer but it's just VERY clear what's going on in each step and it's easy to make it safe (delays are active even when RUN is off).
In Psudo code:
Code:
State 10:
# Idle state
if RUN:
if TEMP_1 =< 29:
State=20
else
State=40
State 20:
# Fan low
if (TEMP_Aux > 140) or (not RUN):
State=30
State 30:
# Stop fan, 60s delay
TimerOn 60s:
State=10
State 40:
# Fan high
if (TEMP_1 =< 29) or (not RUN):
State=50
State 50:
# Stop fan, 30s delay
TimerOn 30s:
State=10
*** Outputs section:
if State==20:
Fan LOW
if State==40:
Fan HIGH