Contents
viii
ni.com
Chapter 2
Developing Your Application
Choosing a Method to Access the NI-CAN Software .................................... 2-1
G Language (LabVIEW) Function Library ...................................... 2-1
C/C++ Language Interfaces.............................................................. 2-1
Direct Entry Access .......................................................................... 2-2
Choosing Which NI-CAN Objects to Use ...................................................... 2-4
Using CAN Network Interface Objects............................................ 2-4
Using CAN Objects .......................................................................... 2-5
Step 1. Configure Objects................................................................. 2-8
Step 2. Open Objects ........................................................................ 2-8
Step 3. Start Communication............................................................ 2-8
Step 4. Communicate Using Objects ................................................ 2-9
Step 5. Close Objects........................................................................ 2-9
Error and Warning Indicators (Severity) .......................................... 2-10
Code.................................................................................................. 2-10
Qualifier............................................................................................ 2-11
Checking Status in LabVIEW......................................................................... 2-11
Checking Status in C....................................................................................... 2-12
Chapter 3
NI-CAN Programming Techniques
State Transitions.............................................................................................. 3-1
Empty Queues ................................................................................................. 3-1
Full Queues ..................................................................................................... 3-2
Disabling Queues ............................................................................................ 3-2
Using the CAN Network Interface Object with CAN Objects...................................... 3-2
Detecting State Changes................................................................................................ 3-4
RTSI Examples.............................................................................................................. 4-2
Example 1. Using CAN Objects.................................................................................... 4-2
Example 2. Simple CAN Bus Analyzer ........................................................................ 4-4
Example 3. Interactive CAN Example .......................................................................... 4-6