Signal Input Single-Point Mode
- Updated2023-09-14
- 3 minute(s) read
Signal Input Single-Point Mode
This mode reads the most recent value received for each signal. It typically is used for control or simulation applications, such as Hardware In the Loop (HIL).
This mode does not use queues to store each received frame. If the interface receives two frames prior to calling nxReadSignalSinglePoint , that call to nxReadSignalSinglePoint returns signals for the second frame.
Use nxReadSignalSinglePoint for this mode.
You also can specify a trigger signal for a frame. This signal name is :trigger:. <frame name> , and once it is specified in the nxCreateSession signal list, it returns a value of 0.0 if the frame did not arrive since the last Read (or Start), and 1.0 if at least one frame of this ID arrived. You can specify multiple trigger signals for different frames in the same session. For multiplexed signals, a signal may or may not be contained in a received frame. To define a trigger signal for a multiplexed signal, use the signal name :trigger:.<frame name>.<signal name> . This signal returns 1.0 only if a frame with appropriate set multiplexer bit has been received since the last Read or Start.
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. Each frame contains its name (C or E), followed by the value of its two signals. The timelines shows three calls to nxReadSignalSinglePoint.
The following figure shows the data returned from each of the three calls to nxReadSignalSinglePoint. The session contains all four signals.
In the data returned from the first call to nxReadSignalSinglePoint , values 3 and 4 are returned for the signals of frame C. The values of the first reception of frame C (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 nxReadSignalSinglePoint , so the last two values return the signal Default Values. For this example, assume that the Default Value is 0.0.
In the data returned from the second call to nxReadSignalSinglePoint , values 3 and 4 are returned again for the signals of frame C, because no new frame has been received since the previous call to nxReadSignalSinglePoint. New values are returned for frame E (5 and 6).
In the data returned from the third call to nxReadSignalSinglePoint , both frame C and frame E are received, so all signals return new values.