Mode Dependent Channels

NI-CAN

Mode Dependent Channels

By definition, CAN supports a limited number of unique identifiers to transmit data between the nodes of a network. In some cases the number of available identifiers is too small to transmit all of the data, so an extension to these identifiers is needed. The concept of mode dependent messages defines a mode channel that functions like a sub-identifier within a CAN frame to determine the meaning of the rest of the data transmitted in the frame.

The mode channel is an implicit channel inside the CAN frame that cannot be accessed by an application for read or write operations. Each channel that relies on a mode channel is associated to a certain mode of that mode channel. This way the mode channel determines the distribution of the data in a CAN frame to the associated CAN channels in the application. Since a single CAN frame no longer contains data for all of these mode dependent channels associated with a CAN message, mode dependent channel data is buffered inside the NI-CAN driver. If the application reads data from a channel, the most recent received value will be returned for that channel. Writing data from mode dependent channels will result in sending one CAN frame per mode, defined for the appropriate task. If more than one mode channel is defined for a CAN message, the NI-CAN driver assures that each mode of each mode channel is sent at least once with every write operation.

For periodic data transmission the property Message Multiple Frame Distribution determines the mode for the transmission of the CAN frames of the appropriate CAN message. If Message Multiple Frame Distribution is set to Uniform, the CAN frames are sent equally distributed within the time frame selected for the transmission. If Message Multiple Frame Distribution is set to Burst, all CAN frames associated to the CAN message will be transmitted as fast as possible at the beginning of the time frame selected for the transmission.

As mentioned before, a consequence of using mode dependent channels is that not every CAN frame received contains data for all channels associated with the appropriate CAN message. If you are reading data in timestamped mode for normal CAN channels, you receive data for all of the channels associated with the CAN message and timestamp information denoting when the data was received by the CAN interface. In the case of mode dependent channels, you get valid data only for those channels that were part of the most recent CAN frame, along with the timestamp denoting when the frame was received by the CAN interface.

The data of any mode dependent channel is invalid if it is not transmitted with the most recent CAN frame associated with the CAN message. The invalid data is replaced with a special value. Before you can start a CAN task that uses mode dependent messages, you have to define the special value for these cases by setting the property Value for Invalid Data.

Mode Dependent Channels in MAX

Mode dependent channels can be defined interactively in MAX. To create mode dependent channels in MAX, right-click on a message and create a multiplexer, as shown in the following figure.

Creating a Multiplexer in MAX

Within the multiplexer dialog box define the properties of the mode channel. On a multiplexer item create a mode item and define the value of the mode channel (mode value). On a mode item, create channels which are only valid when the mode-channel contains the specified mode value. The channels of different modes in the same multiplexer may overlap each other, as shown in the following figure.

Mode Dependent Channels in the MAX Configuration Tree