DNx-MUX-414 / DNR-MUX-418 1x3 Multiplexer Board
Chapter 2
15
Programming with the High-Level API
May 2019
www.ueidaq.com
508.921.4600
© Copyright 2019
United Electronic Industries, Inc.
2.7
Monitoring
Relay States
& Status
You can monitor current relay states and status data with the
ReadStatus
method:
ReadStatus(uInt32 *relayA, uInt32 *relayB,
uInt32 *relayC, uInt32 *status)
where
•
relayA
: bitwise representation of relay A states (1 is closed, 0 open)
•
relayB
: bitwise representation of relay B states
•
relayC
: bitwise representation of relay C states
•
status
: bitwise representation of board status
Status is returned as:
•
Bit 17
: ‘1’ means data is ready from ADC
•
Bit 16
: ‘1’ means overrun (write while busy)
•
Bit 3
: ‘1’ means state machine is busy
•
Bit 2
: ‘1’ means output state machine is waiting for the
external SYNC/ready
•
Bit 1
: ‘1’ means relays are settled
•
Bit 0
: reports the logic state of the sync in pin
•
all other bits are <Reserved>
The following code shows how to read the relay states and status:
2.8
Cleaning-up
the Session
The session object will clean itself up when it goes out of scope or when it is
destroyed. To reuse the object with a different set of channels or parameters,
you can manually clean up the session as follows:
// read all current relay state and status
uInt32 stRelayA, stRelayB, stRelayC, status;
muxWriter.ReadStatus(&stRelayA, &stRelayB, &stRelayC, &status);
// print results
std::cout << std::hex << " relayA=" << stRelayA <<
" relayB=" << stRelayB <<
" relayC=" << stRelayC <<
" status=" << status << std::dec << std::endl << std::endl;
// clean up the session
muxSession.CleanUp();