Example 2. Simple Can Bus Analyzer - National Instruments NI-CAN User Manual

Table of Contents

Advertisement

Chapter 4
Application Examples

Example 2. Simple CAN Bus Analyzer

NI-CAN User Manual
Figure 4-1. Program Flowchart for Example 1
This example focuses on usage of the
within the C programming language. It illustrates a simple CAN bus
analyzer using the CAN Network Interface Object.
An automotive test engineer is writing a diagnostic utility for use in service
bays. This utility is used to diagnose problems with car models that use
Configure CAN Network
1
Interface Objects
2
Configure CAN Objects
ncOpenObject
3
Open CAN Objects
Write Data to be Transmitted
4
Periodically from CAN1::STD5
ncWaitForState
Wait for First Transmission
5
to Complete
ncWaitForState
Wait for Reception of Periodic
6
Data on CAN0::STD5
Read Data from CAN0::STD5
7
8
Finished Ten
Periods?
No
Yes
ncCloseObject
Close CAN Objects
9
ncCreateNotification
4-4
ncConfig
ncConfig
ncWrite
ncRead
function
ni.com

Advertisement

Table of Contents
loading

Table of Contents