Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

OpNI-CAN Recv

Block

Mask

Description

The OpNI-CAN Recv block allows receiving CAN messages for one Standard or Extended identifier. The block refers to a physical port that is configured in the OpNI-CAN Ctl block.

Parameters

Controller IDControllerID refers to the OpNI-CAN Ctl block where the NI-CAN port configuration is provided.
IdentifierNumber identifier of the message to be received.
Identifier TypeNormal type allows 11 bits identifier while extended allows 29 bits.
Output Line WidthList that defines how the data from the CAN message is supplied on the Data output pin. The list is handled from left to right and starts at Byte 0 of the CAN message. ie. A list of [4 4 8] means that the first (MSB) 4 bits of CAN message Byte 0 will be supplied on the Data output pin followed by the next 4 bits of Byte0 and the 8 bits forming Byte1.
Maximum number of frames to read

The maximum number of frames to obtain from the read queue at a time. If there isn't enough frames on the read queue, the available frames will be read and the others will be zero. The actual number of frames read will be indicated by the Nbr of Packet output.



Note: reading more than one frame at a time is not supported yet in RT-LAB.


Read queue sizeThe maximum number of unread frames to hold in the internal buffer. Choose a value between 0 and 100. It should normally be equal to or greater than the Maximum number of frames to read parameter. When a new data item arrives at the full queue, NI-CAN discards the item, and an overflow error will be reported. To avoid this behavior, set the read queue size to zero. When a new data item arrives for a zero-length queue, it simply overwrites the previous item without indicating an overflow. It is useful if you only want the most recent data. Of course, this only applies if you are reading only one frame at a time.
Sample TimeSample time of the block. A value of 0 represents the fastest sample time of the model.
Show timestampsCreates an additional outport which returns the timestamp of incoming messages in seconds. If more than one frame is read, this output is a vector. The first element represents the timestamp of the first data output.
Show scaled valuesOutport which creates an additional out port which returns the Data values with applied Gains and Offset (Scaled value=DATA*GAIN+OFFSET).
GainVector the same length as Output line width specifying gain values to be applied.
OffsetVector the same length as Output line width specifying offset values to be applied.
Show DLCCreates an additional outport which returns message length in bytes. If more than one frame is read, this output is a vector. The first element represents the message length of the first data output.
Data unpacking

This option allows to format data unpacking for compatibility with other devices. 2 notions are implied.

The first specifies if the unpacking of the signal should be started from the start or end of the packet. If Signal 1 to N is selected, the packing will start from the less significant bits of the first transmitted byte. If Signal N to 1 is selected, unpacking will start from the most significant bits of the last transmitted byte and progress backward into the packet.

The second specifies if groups of 8, 16 or 32 bits must be permuted within the packet with respect to its middle boundary. Swapping is performed before extracting signals.

Signal 1 to N - No swapping corresponds to the Intel format while Signal N to 1 - Swap 8-bit corresponds to the Motorola format.


Inputs

This block has no input.

Outputs

Error: Reception Error value. The following table shows possible values and meaning:

Error values
NegativeBus Error
0No Error
PositiveBus Warning

Status: Reception Status value. The following table shows possible values and meaning:

Status values
1A new message is available
0No new message 

Data: Single element or vector containing the values of the message in the format specified in the Output Width List parameter.

Scaled values: Single element or vector containing the values of the message with applied gain and offset.

Nbr of Packet: Returns the number of new messages that are available on the Data output pin(s).

Timestamp: Optional outport which indicates timestamp in seconds of the received message. A single element if only one message if read at a time or a vector.

DLC: Optional outport which returns the length in bytes of the received packet. A single element if only one message if read at a time or a vector if multiple frames are read.

Characteristics and Limitations

Board

The PXI-CAN board is very sensitive to IRQ problems. In the PXI chassis, the model can crash silently if the board is sharing its IRQ line with other devices. If crashes are experienced, changing the PXI slot may correct the problem, if not, use the BIOS utility to assign an IRQ line exclusively for the CAN board.

Direct FeedthroughNo
Discrete sample timeYes
XHP supportNo
Work offlineNo

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter