Use the digital point’s built-in on-latch and off-latch instead of maintaining a controller-side LastState variable. The I/O rack brain captures transitions locally, allowing PAC Control to read an edge that may no longer be present when controller logic next checks the input.
Why Current-State Polling Can Miss an Edge
A current-state comparison detects a transition only when the application observes both states in sequence. A short low-to-high-to-low pulse can occur between monitoring-loop executions, leaving the current value unchanged from the previous observation. The source reports this behavior with momentary-switch inputs, where direct state queries often missed quick signals.
if ((InputPoint=1) and (LastState=0)) Then
LastState=1;
Perform on-edge reaction
elseif ((InputPoint=0) and (LastState=1)) Then
LastState=0;
Perform off-edge reaction
endif
Select the Appropriate Digital Latch
| Required event | Supported feature or command | Decision |
|---|---|---|
| Low-to-high transition | Input On-Latch or GetOnLatch
|
Read the on-latch when logic must react to an asserted edge. |
| High-to-low transition | Input Off-Latch or GetOffLatch
|
Read the off-latch when logic must react to a deasserted edge. |
| Consume an on-edge in one operation | Get and clear on latch |
Use when the application should acknowledge the captured edge as it reads it. |
A plain latch read leaves the latch set until a separate clear operation. That behavior is useful when processing must finish before acknowledgment, but another transition occurring while the latch remains set may not be distinguishable as a separate event. Use the get-and-clear form when immediate consumption matches the application.
Implement Edge Handling
- Identify whether the required reaction follows an on-edge, an off-edge, or both.
- Inspect the Ethernet I/O digital point in PAC Manager to confirm that its latch values are available at the rack.
- In PAC Control, read the corresponding latch rather than relying only on the point’s current state.
- Clear the latch after accepting the event, or use
Get and clear on latchwhen the read should also acknowledge it.
The evidence names the commands but does not provide their complete argument syntax. Use the Digital Point section of the installed command reference to select the exact command form for the configured point.
Verify That Short Transitions Are Captured
Exercise the input with a pulse short enough that current-state polling can miss it. Confirm that the appropriate on-latch or off-latch becomes set at the rack, PAC Control detects the event, the required reaction executes once, and the latch clears according to the selected acknowledgment strategy. Also verify behavior when a second transition occurs before a separately read latch is cleared.
FAQ
How do I detect a rising edge in PAC Control?
Read the digital point’s Input On-Latch with GetOnLatch, or use Get and clear on latch when the same operation should acknowledge the event.
Why does PAC Control miss a momentary input?
A short pulse can begin and end between current-state queries. The rack brain’s digital latch captures the transition locally so controller logic can read it later.
What is the difference between reading and clearing an on-latch?
A normal latch read leaves the captured state set until it is cleared separately. Get and clear on latch reads and acknowledges the captured on-edge in one operation.