Detecting State Changes - National Instruments NI-CAN User Manual

Table of Contents

Advertisement

Chapter 3
NI-CAN Programming Techniques

Detecting State Changes

NI-CAN User Manual
comparator attributes to
communications controller chip is best able to filter out all incoming frames
except those handled by CAN Objects.
You can detect state changes for an object using one of the following
schemes:
Call
ncGetAttribute
Call
ncWaitForState
Use
ncCreateNotification
states.
Use the
ncGetAttribute
current state of an object. For example, if you want to determine
whether a background error has occurred for an object, you can use
to obtain the state and check for
ncGetAttribute
Use the
ncWaitForState
specific state before proceeding. For example, if you call
a frame, and your application cannot proceed until the frame is successfully
transmitted, you can call
NC_ST_WRITE_SUCCESS
Use the
ncCreateNotification
handle a specific state, but can perform other processing while waiting for
that state to occur. The
callback function, which is invoked when the desired state occurs. For
example, a callback function for
and place the resulting data in a buffer. Your application can then perform
any tasks desired, and process the CAN data only as needed.
NC_CAN_ARBID_NONE
to get the
NC_ATTR_STATE
to wait for one or more states to occur.
to register a callback for one or more
function when you need to determine the
function when your application must wait for a
ncWaitForState
.
function when your application must
ncCreateNotification
NC_ST_READ_AVAIL
3-4
. By doing this, the CAN
attribute.
NC_ST_ERROR
ncWrite
to wait for
function registers a
can call
ncRead
.
to write
ni.com

Advertisement

Table of Contents
loading

Table of Contents