Frame Input Single-Point Mode
- Updated2023-09-14
- 2 minute(s) read
Frame Input Single-Point Mode
This mode reads the most recent value received for each frame. It typically is used for control or simulation applications that require lower level access to frames (not signals).
This mode does not use queues to store each received frame. If the interface receives two frames prior to calling nxReadFrame, that read returns signals for the second frame.
The input data is returned as an array of frames, one for each frame specified for the session.
Example
In this example network, frame C is a cyclic frame that transmits on the network once every 2 ms. Frame E is an event-driven frame. For information about cyclic and event-driven frames, refer to Cyclic and Event Timing.
Each frame contains two signals, one in the first byte and another in the second byte.
The example uses CAN. The following figure shows a timeline of a frame transfer on the CAN network, followed by a single call to nxReadFrame. Each frame contains its name (C or E), followed by the value of its two signals.
The following figure shows the data returned from each of the three calls to nxReadFrame. Each frame is displayed with CAN-specific elements. For information about the data returned from the read function, refer to Raw Frame Format. The session contains frame data for two frames: C and E.
In the data returned from the first call to nxReadFrame, frame C contains values 3 and 4 in its payload. The first reception of frame C values (1 and 2) were lost, because this mode returns the most recent values.
In the frame timeline, Time of 0 ms indicates the time at which the session started to receive frames. For frame E, no frame is received prior to the first call to nxReadFrame, so the timestamp is invalid, and the payload is the Default Payload. For this example we assume that the Default Payload is all 0.
In the data returned from the second call to nxReadFrame, payload values 3 and 4 are returned again for frame C, because no new frame has been received since the previous call to nxReadFrame. The timestamp for frame C is the same as the first call to nxReadFrame.
In the data returned from the third call to nxReadFrame, both frame C and frame E are received, so both elements return new values.