Example Code

CAN Bus Monitor for cRIO

Code and Documents

Attachment

Overview


This CAN Bus Monitor monitors received CAN frames and optionaly logs them to a file. The monitor shows the frame content and calculates number and period for a certain ID.

This example shows how to receive and monitor CAN frames on a single port of a NI 985x c-series module for cRIO or R-Series devices.

The FPGA VI receives up to 100 % busload and optional error frames and transfers them via DMA to the RT Host.

The Host VI receives the frames from DMA FIFO and monitors them in ID order along with Frame length, data, timestamp, number of received frames and period.

Optionally you can log the frames to a file for later processing. The log part uses example VIs, which are not included with this example. You have to install NI-CAN 2.4 and later in order to install these files.

The example project is configured for 500 KBaud and recovers from bus failures.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors