DNx-AI-208 Analog Input Layer
Chapter 2
7
Programming with the High Level API
Tel: 508-921-4600
www.ueidaq.com
Vers:
4.6
Date: November 2013
File:
AI208 Chap2.fm
© Copyright 2009
United Electronic Industries, Inc.
Chapter 2
Programming with the High Level API
This chapter describes how to program the PowerDNA/DNR-AI-208 using
UeiDaq’s Framework High Level API.
Since Framework is object oriented; its objects can be manipulated in the same
manner using different development environments, such as Visual C++, Visual
Basic, or LabVIEW.
Although the following section focuses only on the C++ API, the concept is the
same no matter what programming language you use.
Please refer to the “UeiDaq Framework User Manual” for more information on
using other programming languages.
2.1
Creating a
session
The Session object controls all operations on your PowerDNA device. There-
fore, the first task is to create a session object, as follows.
CUeiSession session;
2.2
Configuring
Channels
and
Excitation
Framework uses resource strings to select each device, subsystem and chan-
nels to use within a session.
The resource string syntax is similar to a web URL:
<device class>://<IP address>/<Device Id>/<Subsystem><Channel list>
For PowerDNA, the device class is
pdna
.
For example, the following resource string selects analog input channels 0,2,3,4
on device 1 at IP address 192.168.100.2:
“pdna://192.168.100.2/Dev1/Ai0,2,3,4”
The gain to be applied on each channel is specified with low and high input
limits.
For example, the AI-208 available gains are 1, 2, 4, 8, 10, 20, 40, 80,100, 200,
400, 800 and the maximum input range is [-10V, 10V].
To select a gain of 100, you must specify input limits of [-0.1V, 0.1V].
// Configure channels 0,1 to use a gain of 100 in
// differential mode
session.CreateAIChannel(“pdna://192.168.100.2/Dev0/Ai0,1”, -0.1, 0.1,
UeiAIChannelInputModeDifferential);
To program the excitation circuitry, you need to configure the channel list using
the session object method
“CreateAIVExChannel”
instead of
“Cre-
ateAIChannel”.
This method also gives you the ability to select the bridge configuration you want
and to select whether or not you wish to obtain the acquired data already scaled
in mV/V (acquired voltage divided by actual excitation voltage), as follows: