Need help? Talk to a specialist 1-800-956-4437
Request Demo Request Info/Price

Measuring and Sending Analog Sensor Data via the CANbus

ADwin Data Acquisition and Control

In automotive or other vehicle applications, it’s often desirable to read data from one or more sensors providing an analog voltage output and to transmit this data via the CANbus; this way it can be read along with other data being broadcast by an ECU by a single data logging device. ADwin data acquisition systems provide an ideal platform to implement a simple solution for this. These stand-alone real-time data acquisition and control systems feature analog, digital, CANbus, and Serial I/O for use in research, manufacturing, test stand, aerospace and automotive applications.

ADwin data acquisition and control systems are available in several different models with different analog input capabilities, but they are all suitable for this application when outfitted with the CANbus interface option. The flexibility of the open programming environment of ADwin systems makes it especially easy to read and scale the data. High level functions and built-in message structures allow the generation and transmission of CAN messages with just a few simple statements.

The ADwin operating system is an event-based environment which allows periodic message generation without the need for special timing routines. In the example below, the GLOBALDELAY statement sets the event loop to execute every millisecond to read and transmit the data. In this example the data is being broadcast, but it is quite easy to configure the system to use polled message transmission. In this case, the CAN interface can be configured to look for a particular message ID and generate an interrupt to trigger the event loop and send the data.

Other powerful features of the ADwin systems are the built-in high level functions and their ability to freely program calculations with very little overhead. In the example below, it is obvious how easy it is to read the A/D converter; a single instruction returns the current input value. Likewise, scaling calculations can be done with a single, intuitive equation. These capabilities enable more complex operations such as averaging, filtering, and statistical operations. Internal routines which handle casting operations make it easy to manipulate integer, floating point and binary data transparently.

The ADwin architecture provides for transparent shared data between the internal operating environment of the ADwin system and an attached PC. For debugging, this greatly simplifies monitoring the values of variable via the PAR (integer) and FPAR (floating point) shared data. The environment also provides for data arrays to enable charting and logging.

The following sample program is for an ADwin-Pro system with a Pro-Ain-32/16, 16 bit analog input card and a Pro-CAN-2, 2 channel high speed CAN interface card.

ADwin Pro-II Sample Program