©
National Instruments Corporation
4-1
4
Application Examples
This chapter describes the sample applications provided with your NI-CAN
software.
The examples in this chapter are designed to illustrate basic NI-CAN
programming, as well as specific concepts and techniques that can help you
write your own applications. The description of each example includes the
programmer’s task, a program flowchart, and numbered steps that
correspond to the numbered blocks on the flowchart.
The following example programs are included with your NI-CAN
software:
•
obj2obj.c
is the C source code file for Example 1.
obj2obj.vi
is
t
he LabVIEW source code file for Example 1. In this example, one
CAN Object is used to periodically transmit data to another CAN
Object.
•
simpanlz.c
is the C source file for Example 2. This example
illustrates a simple CAN bus analyzer using the CAN Network
Interface Object. It also demonstrates usage of the
ncCreateNotification
function.
•
interact.vi
is the LabVIEW source code file for Example 3. In this
example, one CAN Network Interface Object and one CAN Object are
used to transmit and receive CAN frames interactively.
•
ReadMult.c
is the C source file for the
ncReadMult
function. This
example shows how to use the function to retrieve CAN frames from
the read queue. The example can be used as the basis for building
analyzer-style applications to retrieve high-speed incoming data for
future analysis. When used with the Network Interface Object, this
function allows more data processing time because it retrieves multiple
frames in one call, as opposed to the
ncRead
function that retrieves
one frame per call.
•
ReadMultNet.vi
and
ReadMultObj.vi
are
LabVIEW/BridgeVIEW examples for using the
ncReadNetMult.vi
and
ncReadObjMult.vi
. The primary difference between the two vis
is the data cluster used to output the received data. The
ncReadNetMult.vi
use the
NCTYPE_CAN_FRAME_TIMED
cluster