![United Electronic Industries PowerDNA DIO-403 Скачать руководство пользователя страница 11](http://html.mh-extra.com/html/united-electronic-industries/powerdna-dio-403/powerdna-dio-403_user-manual_844930011.webp)
United Electronics Industries, Inc.
Tel: 781-821-2890
www.ueidaq.com
Fax: 781-821-2891
PowerDNA DIO-403 Layer
-6-
The following sample shows how to configure the simple mode. Please refer to
the “UeiDaq Framework User’s Manual” to learn how to use the other timing
modes.
session.ConfigureTimingForSimpleIO();
2.4 Reading data
Reading data from the DIO-403 is done by using a reader object.
The following sample code shows how to create a scaled reader object and read
samples.
// Create a reader and link it to the session’s stream
CUeiDigitalReader reader(di_session.GetDataStream());
// read one scan, the buffer must be big enough to contain
// one value per channel
uInt16 data;
reader.ReadSingleScan(&data);
Writing data is done by using a writer object. The following sample shows how to
create a writer object and write data .
// Create a writer and link it to the session’s stream
CUeiDigitalWriter writer(do_session.GetDataStream());
// write one scan, the buffer must contain
// one value per channel
uInt16 data = 0xFEFE;
writer.WriteSingleScan(&data);
2.5 Cleaning-up the session
The session object will clean itself up when it goes out of scope or when it is
destroyed. However, you can manually clean up the session (to reuse the object
with a different set of channels or parameters) as follows.
session.CleanUp();