United Electronics Industries, Inc.
Tel: 781-821-2890
www.ueidaq.com
Fax: 781-821-2891
PowerDNA DIO-403 Layer
-7-
3
Programming using the Low-Level API
This section describes how to program the PowerDNA cube using the low-level
API. The low-level API offers direct access to PowerDNA DAQBios protocol
and also allows you to access device registers directly.
We recommend that you use the UeiDaq framework (
see Section 2 above
), which
is easier to use.
You should need to use the low-level API only if you are using an operating
system other than Windows.
3.1 Data representation
Internally, the DIO-403 presents the state of its line in two 32-bit words; each one
contains 24 bits of data.
At the user level, read or write data is presented in an array of six bytes. Each
byte represents one of the six I/O ports available.
3.2 Configuration settings
Configuration settings are passed in the
DqCmdSetCfg()
function.
Not all configuration bits apply to DIO-403 layers.
Following bits are used:
#define DQ_LN_MAPPED (1L<<15) // For WRRD (DMAP) devices (automatically selected)
#define DQ_LN_ACTIVE (1L<<1) // “STS” LED status
#define DQ_LN_ENABLED (1L<<0) // enable operations
DQ_LN_ACTIVE
is needed to switch on “STS” LED on the CPU layer.
DQ_LN_ENABLE
enables all operations with the layer
Layer-specific bits are the follows:
// enable ports 0..5 for write (otherwise they are in tristate - read)
#define DQ_DIO403_ENPORT5 (1UL << 13)
#define DQ_DIO403_ENPORT4 (1UL << 12)
#define DQ_DIO403_ENPORT3 (1UL << 11)
#define DQ_DIO403_ENPORT2 (1UL << 10)
#define DQ_DIO403_ENPORT1 (1UL << 9)
#define DQ_DIO403_ENPORT0 (1UL << 8)