Chapter 4
Application Examples
4-2
ni.com
and
ncReadObjMult.vi
uses the
NCTYPE_CAN_DATA_TIMED
cluster.
•
SimpanlzLS.c
is the C source that shows the use of the
NC_ATTR_LOG_COMM_ERRS
attribute for low-speed CAN
applications.
•
InteractLS.vi
is the LabVIEW/BridgeVIEW example that shows
the
ncNetAttrLS
cluster that lets you set the
NC_ATTR_LOG_COMM_ERRS
attribute for low-speed CAN applications
RTSI Examples
Refer to the
NI-CAN Programmer Reference Manual
for a list of examples.
Example 1. Using CAN Objects
This example focuses on the basics of using CAN Objects.
An automotive test engineer is trying to test a variety of CAN devices. One
of the CAN devices is a speed display. This display expects to receive the
current speed of the vehicle in a CAN frame every 100 milliseconds, so that
the driver of the vehicle can be continuously updated. Another CAN device
is a speed sensor (speedometer), which measures the speed of the vehicle
and transmits it in a CAN frame every 100 milliseconds.
To use NI-CAN to test the speed display, the engineer uses a CAN Object
to simulate the role of the speed sensor. This CAN Object is configured to
transmit a simulated speed every 100 milliseconds. By using the CAN
Object to transmit different speeds, the test engineer can verify that the
speed display always shows the correct speed.
To use NI-CAN to test the speed sensor, the engineer uses a CAN Object to
simulate the role of the speed display. This CAN Object is configured to
receive speeds from the sensor and display them. By using this CAN Object
to receive and display different speeds, the test engineer can connect the
speed sensor to a real engine, then verify that the speeds it transmits are
correct.
To learn the basics of CAN Object usage prior to testing the actual devices,
the test engineer writes a simple example to implement both CAN Objects.
To do this, he uses a two-port CAN interface, such as the AT-CAN/2. He
connects the top port of the card to the bottom port using a cable. One port