I have 25 monitors in the field and I have a heartbeat and want to run a snip of code for each one to have a loss of comm bit if WW stops seeing the heartbeat transitioning. I'm trying to minimize replicated code by using a quickfunction, but it doesn't seem to work the way I think it should.
I have the following:
Function:WATCHDOG
Arguments:
Code:
I use the following to call the QuickFunction:
I tried calling the function in application script every second. I've also tried calling it using a button. I can't get anything to work. I've even tried simplifying the code to a simple IF HeartBeat Then CommCount = CommCount +1. It works if I put code into a button to test, but my QuickFunction doesn't do it. I've swapped the MISC_ARRAY bit with a memory discrete to see if it didn't like the array bit, and it wasn't that either.
Any ideas on what I'm doing wrong, or am I going about this the wrong way? I've goolged and read the help files and don't see what I'm missing.
edit: I also tried to RETURN the CommOK status by using AT0034S_COMM_OK = CALL WATCHDOG(parameters) and returning just the CommOk because that's all I care about.
I have the following:
Function:WATCHDOG
Arguments:
Code:
CommCount (integer)
LastComm (discrete)
HeartBeat (discrete)
CommOK (discrete)
Code:
Code:
IF CommCount < 10 AND LastComm == HeartBeat THEN
CommCount = CommCount + 1;
ENDIF;
IF LastComm <> HeartBeat THEN
CommOK = 1;
CommCount = 0;
ENDIF;
IF CommCount >= 10 THEN
CommOK = 0;
ENDIF;
LastComm = HeartBeat;
I use the following to call the QuickFunction:
Code:
CALL WATCHDOG(AT0034S_COMMCOUNT, AT0034S_LASTCOMM, AT0034S_MISC_ARRAY.00, AT0034S_COMM_OK);
I tried calling the function in application script every second. I've also tried calling it using a button. I can't get anything to work. I've even tried simplifying the code to a simple IF HeartBeat Then CommCount = CommCount +1. It works if I put code into a button to test, but my QuickFunction doesn't do it. I've swapped the MISC_ARRAY bit with a memory discrete to see if it didn't like the array bit, and it wasn't that either.
Any ideas on what I'm doing wrong, or am I going about this the wrong way? I've goolged and read the help files and don't see what I'm missing.
edit: I also tried to RETURN the CommOK status by using AT0034S_COMM_OK = CALL WATCHDOG(parameters) and returning just the CommOk because that's all I care about.
Last edited: