Chapter 2
9
Programming with the High-Level API
Tel: 508-921-4600
www.ueidaq.com
Vers:
1.4
Date:
September 2010
File:
AO-308-353 Chap2.fm
© Copyright 2009
United Electronic Industries, Inc.
The following sample shows how to configure the simple mode. Please
refer to the “UeiDaq Framework User Manual” to learn how to use the
other timing modes.
session.ConfigureTimingForSimpleIO();
2.1.4
Writing Data
Writing data to the AO-308-353 board is done with a writer object. You
can create a writer object that writes raw data straight to the D/A
converter. You can also create a writer object that writes data scaled to
volts. Framework automatically performs a conversion to binary code
before sending the data to the D/A converter.
The following sample code shows how to create a scaled writer object
and write a sample.
// Create a reader and link it to the
// session’s stream
CueiAnalogScaledWriter
writer(session.GetDataStream());
// write one scan, the buffer must contain
// one value
// for each channel
double data[2] = {0.0, 0.0};
writer.WriteSingleScan(data);
Similarly, you can create a raw writer object by entering the following:
// Create a reader and link it to the session’s stream
CUeiAnalogRawWriter writer(session.GetDataStream());
// write one scan, the buffer must contain one value
// for each channel
uInt16 data[2] = {0x1234, 0x5678};
writer.WriteSingleScan(data);
All the AO-308x analog output s are programmed the same way.
2.1.5
Cleaning-up
the Session
The session object cleans itself up when it goes out of scope or when it
is destroyed. If you want to reuse the object with a different set of
channels or parameters, you can manually clean up the session with the
following:
session.CleanUp();
Summary of Contents for DNx-AO-308-353
Page 3: ...iii ...