Choosing Which Ni-Can Objects To Use; Using Can Network Interface Objects - National Instruments NI-CAN User Manual

Table of Contents

Advertisement

Chapter 2
Developing Your Application

Choosing Which NI-CAN Objects to Use

NI-CAN User Manual
status = (*PncOpenObject) ("CAN0", &MyObjh);
if (status < 0) {
printf("ncOpenObject failed");
}
Before exiting your application, you need to free
following command:
FreeLibrary(NicanLib);
For more information on direct entry, refer to the Win32 SDK (Software
Development Kit) online help.
An application written for NI-CAN communicates on the network by using
various objects. Which NI-CAN objects to use depends largely on the
needs of your application. The following sections discuss the objects
provided by NI-CAN, and reasons why you might use each class of object.

Using CAN Network Interface Objects

The CAN Network Interface Object encapsulates a physical interface to a
CAN network, usually a CAN port on an AT or PCI interface.
You use the CAN Network Interface Object to read and write complete
CAN frames. As a CAN frame arrives from over the network, it can be
placed into the read queue of the CAN Network Interface Object. You can
retrieve CAN frames from this read queue using the
For CAN Network Interface Objects, the
timestamp of when the frame was received, the arbitration ID of the frame,
the type of frame (data or remote), the data length, and the data bytes. You
can also use the CAN Network Interface Object to write CAN frames using
the
function.
ncWrite
Some possible uses for the CAN Network Interface Object include the
following:
You can use the read queue to log all CAN frames transferred across
the network. This log is useful when you need to view preceding CAN
traffic to verify that all CAN devices are functioning properly.
You can use the write queue to transmit a sequence of CAN frames in
quick succession. This is useful for applications in which you need to
simulate a specific sequence of CAN frames to verify proper device
operation.
ncRead
2-4
with the
nican.dll
function.
ncRead
function provides a
ni.com

Advertisement

Table of Contents
loading

Table of Contents