Analog I/O Library
Slider_AnalogIO_API_color.jpg

Introduction

This analog I/O library defines a common interface for reading analog input values and writing analog output values.


Including

The way how you include the library functions in your own windows program, depends on the compiler and on the programming language you use. In order to access the analog I/O API, you have to include the library labbCAN_AnalogIO_API.dll to your programming environment. You have to copy this file to the working directory of your system or to the application directory that contains your application EXE file. Use the calling convention __stdcall for this library. This convention is managing how the parameters are put on the stack and who is responsible to clean the stack after the function execution.

The interface of the library, constant definitions and declarations of the library functions, is defined in the header file interface/labbCAN_AnalogIO_API.h


Analog I/O API Usage

Retrieve device handle

To work with an analog I/O channel, you need a valid channel handle. A channel handle is simply an opaque pointer to the internal channel object created by the labbCAN environment. So the first thing you need do to is obtaining a valid analog I/O channel handle.

You can get a valid output channel handle with the function LCAIO_LookupOutChanByName() and a valid input channel handle with the function LCAIO_LookupInChanByName():

dev_hdl hAnalogIn;
Result = LCAIO_LookupInChanByName("neMAXYS1_AnIN2", &hAnalogIn);
dev_hdl hAnalogOut;
Result = LCAIO_LookupOutChanByName("neMESYS_AnOUT1", &hAnalogOut);
Note
You can get the channel names from the device configuration files (see Device Configuration Files). Simply search in the channel list for Lcl::CAnalogInChannel or Lcl::CAnalogOutChannel channels.
</ChannelList>
<Channel Name="neMAXYS1_AnIN1">
<Type>Lcl::CAnalogInChannel</Type>
<Device>neMAXYS1_YAnalogIn</Device>
<ChannelNo>0</ChannelNo>
<Scaling Factor="1" Offset="0"/>
</Channel>
<Channel Name="neMAXYS1_AnIN2">
<Type>Lcl::CAnalogInChannel</Type>
<Device>neMAXYS1_YAnalogIn</Device>
<ChannelNo>1</ChannelNo>
<Scaling Factor="1" Offset="0"/>
</Channel>
</ChannelList>

Reference

See the labbCAN Analog I/O API module for a detailed reference of all analog I/O control, status and configuration functions.


Programming Interface - API

See the labbCAN Analog I/O API module for a detailed reference of the Analog I/O library application programming interface