Full Queues; Disabling Queues; Using The Can Network Interface Object With Can Objects - National Instruments NI-CAN User Manual

Table of Contents

Advertisement

Chapter 3
NI-CAN Programming Techniques

Full Queues

Disabling Queues

Using the CAN Network Interface Object
with CAN Objects
NI-CAN User Manual
the data from the previous call to
warning. If no data item has yet arrived for the read
NC_ERR_OLD_DATA
queue, a default data item is returned, which consists of all zeros. You
should generally wait for
.
ncRead
For both read and write queues, the behavior for writing a full queue
is similar. When you write a full queue, NI-CAN returns the
status codes. For example, if you write too many
NC_ERR_OVERFLOW
data items to a write queue, the
overflow error.
If you do not need a complete history of all data items, you may prefer to
disable the read queue and/or write queue by setting its length to zero.
Using zero length queues generally saves memory, and often results in
better performance. When a new data item arrives for a zero length queue,
it overwrites the previous item without indicating an overflow. The
NC_ST_READ_AVAIL
usual, but you can ignore them if you want only the most recent data. For
example, when NI-CAN writes a new data item to the read buffer, the
NC_ST_READ_AVAIL
only want the most recent data, you can ignore the
state, as well as the
NC_ERR_OLD_DATA
For many applications, it is desirable to use a CAN Network Interface
Object in conjunction with higher level CAN Objects. For example, many
CAN devices require a specific sequence of CAN frames to initialize for
data transfer. For such devices, you can use the CAN Network Interface
Object to transmit and receive frames required for initialization, then use
CAN Objects for data transfer (such as transmitting a periodic request for
data). For more information on the different uses of NI-CAN objects, refer
to the
Choosing Which NI-CAN Objects to Use
Developing Your
Application.
When one or more CAN Objects are open, the CAN Network Interface
Object cannot receive frames which would normally be handled by the
is returned again, along with the
ncRead
NC_ST_READ_AVAIL
function eventually returns the
ncWrite
and
NC_ST_WRITE_SUCCESS
state becomes true until the data item is read. If you
warning returned by
3-2
prior to the first call to
states still behave as
NC_ST_READ_AVAIL
ncRead
section in Chapter 2,
ni.com
.

Advertisement

Table of Contents
loading

Table of Contents