National Instruments NI-CAN User Manual page 50

Table of Contents

Advertisement

© National Instruments Corporation
(such as
), as well as the communication baud rate (such as 125000).
CAN0
All frames received are displayed in an array of Received Frames. If you
want to transmit a specific frame, you can enter the desired
,
flag (off means CAN data frame),
Id
Is Remote
bytes, then select
Data
The
front panel also supports an optional CAN Object
interact.vi
configured as Transmit Data Periodically. Before running the example,
select Configure Periodic Transmit to use this object, and also select the
,
Arbitration Id
Data Length
example is running, you can use the Periodic Transmit Data control to
update the data transmitted each period.
For more information on how to use the front panel of
scroll up to the help text located above the front panel controls.
If you do not have a CAN device with which to experiment using
, but you have a two-port CAN interface (such as the
interact.vi
PCI-CAN/2), you can use two copies of
a separate copy of the example (such as
copy on one port (such as
as
).
CAN1
The following steps correspond to the program flowchart in Figure 4-3.
1.
The application calls
Interface Object. The name of the object and its baud rate are obtained
from front panel controls.
2.
The application calls
Interface Object.
3.
If Configure Periodic Transmit is checked, the application calls
to configure the CAN Object. The name of the object is
ncConfig
obtained using the front panel arbitration ID. The data length and
period are also obtained from front panel controls.
4.
If Configure Periodic Transmit is checked, the application calls
to open the CAN Object.
ncOpenObject
5.
If the WRITE button has been selected, the front panel arbitration ID,
remote/data flag, data length, and data are used to call
CAN Network Interface Object.
6.
The
function is called for the CAN Network Interface Object,
ncRead
to see if a CAN frame has been received. If
zero (success) in its
inserted into the Received Frames array.
to transmit.
WRITE
, and
Period
interact.vi
interact2.vi
) and the other copy on the other port (such
CAN0
to configure the CAN Network
ncConfig
to open the CAN Network
ncOpenObject
cluster, the received CAN frame is
error out
4-7
Chapter 4
Application Examples
Arbitration
, and
Data Length
to configure. While the
interact.vi
to experiment. Save
), then run one
ncWrite
returns a code of
ncRead
NI-CAN User Manual
,
for the

Advertisement

Table of Contents
loading

Table of Contents