Hi,
I have a TSTEQ IP2[5000] 1 that isn't waiting the 5 seconds before going true. I've read Lou Apo's explanation of Non-Blocking Delay and the way I understand it is IP2 has to be equal to 1 & it has to be equal to 1 for 5000ms before being true and executing the following line. I did some testing as described here with a LED and it is instantly turning my LED on (as well as sending my email). I've posted my code below... I'm sure there is something simple I'm missing. Any ideas? My FW is 03.02.17.
START
CALLSUB INIT_VARS
BEGIN:
CALLSUB CHECK_IP1
CALLSUB CHECK_IP2
GOTO BEGIN
END
INIT_VARS:
SET VAR1 0
SET VAR2 0
RET
CHECK_IP1:
TSTEQ IP1 1
SET VAR1[30000] 1
RET
CHECK_IP2:
TSTEQ IP2[5000] 1
CALLSUB CHECKVAR1
RET
CHECKVAR1:
TSTEQ VAR1 0
CALLSUB SENDEMAIL
RET
SENDEMAIL:
BNZ VAR2 BEGIN
SET VAR2[30000] 1
EMAIL EM1 **Replaced with SET OP1[5000] 1 for testing**
RET
What I'm trying to do with the code is send an email every 30 seconds if IP2 is activated for more than 5 seconds as long as IP1 has not been triggered. When IP1 is triggered it blocks the email for 30 seconds.
I appreciate any help and ideas you might have!
I have a TSTEQ IP2[5000] 1 that isn't waiting the 5 seconds before going true. I've read Lou Apo's explanation of Non-Blocking Delay and the way I understand it is IP2 has to be equal to 1 & it has to be equal to 1 for 5000ms before being true and executing the following line. I did some testing as described here with a LED and it is instantly turning my LED on (as well as sending my email). I've posted my code below... I'm sure there is something simple I'm missing. Any ideas? My FW is 03.02.17.
START
CALLSUB INIT_VARS
BEGIN:
CALLSUB CHECK_IP1
CALLSUB CHECK_IP2
GOTO BEGIN
END
INIT_VARS:
SET VAR1 0
SET VAR2 0
RET
CHECK_IP1:
TSTEQ IP1 1
SET VAR1[30000] 1
RET
CHECK_IP2:
TSTEQ IP2[5000] 1
CALLSUB CHECKVAR1
RET
CHECKVAR1:
TSTEQ VAR1 0
CALLSUB SENDEMAIL
RET
SENDEMAIL:
BNZ VAR2 BEGIN
SET VAR2[30000] 1
EMAIL EM1 **Replaced with SET OP1[5000] 1 for testing**
RET
What I'm trying to do with the code is send an email every 30 seconds if IP2 is activated for more than 5 seconds as long as IP1 has not been triggered. When IP1 is triggered it blocks the email for 30 seconds.
I appreciate any help and ideas you might have!