If a strategy variable is used by OptoDataLink to initiate a data exchange and the variable is updated too quickly to prompt another data exchange, then the data may not update. For example, the strategy sets a variable to 1 when a data exchange should occur. OptoDataLink exchanges data, and resets the variable to 0 if the Reset Opto 22 device value is checked. If the strategy sets the variable to 1 too quickly again, OptoDataLink may not detect the new request for data.
The image below shows how the Depending on Opto 22 device has the Reset Opto 22 device value set to indicate OptoDataLink should automatically reset the tag.
Use the following logic to set the trigger variable back to True:
- Create a new Integer 32 variable such as nTriggerCount.
- Increment the variable nTriggerCount.
- Verify nTriggerCount rolled over to 0 and reset it to 1.
(Reason: In PAC Control, Integer 32 variables are signed 32-bit integers. When a signed, 32-bit integer is incremented, it follows this incremental pattern: 0, 1, 2, ..., 2147483647, -2147483648, -2147483647, ..., -3, -2, -1, 0, 1, 2, ... All values evaluate as True except for zero.When the variable has incremented to zero, start over at 1.)
- Move the value of nTriggerCount to another Integer 32 variable nTrigger. In this manner, each time nTrigger is changed from false (0) to True (any non-zero value), it will be a value that is different from the last time it was set to True. This causes the data to be detected by OptoDataLink. When OptoDataLink detects the True value, it executes the next data exchange.
In OptoScript the logic is like this:
// Increment the value of nTriggerCount
// Check to see if nTriggerCount rolled over to 0 and if so, set it to 1
if (nTriggerCount == 0) then
nTriggerCount = 1;
// Copy the value of nTriggercount to nTrigger
nTrigger = nTriggerCount;
Opto 22 has resolved this issue.