Frame Output Single-Point Mode

This mode writes frame values for the next transmit. 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 frame values. If nxWriteFrame is called twice before the next transmit, the transmitted frame uses the value from the second call to nxWriteFrame.

The output data is provided as an array of frames, one for each frame specified for the session.

For this mode, NI-XNET transmits each frame according to its properties in the database. Therefore, when you call nxWriteFrame, the number of payload bytes in each frame value must match that frame's Payload Length property. The other frame value elements are ignored, so you can leave them uninitialized. For CAN interfaces, if the number of payload bytes you write is smaller than the Payload Length configured in the database, the requested number of bytes transmit. If the number of payload bytes is larger than the Payload Length configured in the database, the queue is flushed and no frames transmit. For other interfaces, transmitting a number of payload bytes different than the frame payload may cause unexpected results on the bus.

Example

In this example network, frame C is a cyclic frame that transmits on the network once every 2.0 ms. Frame E is an event-driven frame that uses a transmit time (minimum interval) of 2.5 ms. 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 timeline shows three calls to nxWriteFrame.

1378

The following figure shows the data provided to each of the three calls to nxWriteFrame. Each frame is displayed with CAN-specific elements. For information about the data returned from the write function, refer to Raw Frame Format. The session contains frame values for two frames: C and E.

1378

Assuming the Auto Start? property uses the default of true, the session starts within the first call to nxWriteFrame. Frame C transmits followed by frame E, both using frame values from nxWriteFrame.

After the second call to nxWriteFrame, frame C transmits using its value (bytes 3, 4), but frame E does not transmit, because its minimal interval of 2.5 ms has not elapsed since acknowledgment of the previous transmit.

Because the third call to nxWriteFrame occurs before the minimum interval elapses for frame E, its next transmit uses its value (bytes 3, 4, 0, 0). The value for frame E in the second call to nxWriteFrame is not used.

Frame C transmits the third time using the value from the third call to nxWriteFrame (bytes 5, 6). Because frame C is cyclic, it transmits again using the same value (bytes 5, 6).