Skip to main content
Skip table of contents

General Protocol (UD Devices Only)

This section describes the low level functions of the U3, U6, and UE9. These are commands sent over USB directly to the UD device process.

The majority of Windows users will use the high-level UD driver rather than these low-level functions.

Following is a description of the general low-level communication protocol. There are two types of commands:

Normal: 1 command word plus 0-7 data words.

Extended: 3 command words plus 0-125 data words.

Normal commands have a smaller packet size and can be faster in some situations. Extended commands provide more commands, better error detection, and a larger maximum data payload.

The UE9 also supports the Modbus protocol over Ethernet and USB. Learn more about it on the Modbus support page.

Table A. Normal command format

Byte

 

 

 

0

Checksum8: Includes bytes 1-15. 

 

1

Command Byte: DCCCCWWW 

 

 

 

Bit 7: Destination bit: 

 

 

 

0 = Local,

 

 

 

1 = Remote.

 

 

Bits 6-3: Normal command number (0-14). 

 

 

Bits 2-0: Number of data words. 

2-15

Data Words.

 

 

Table B. Extended command format

Byte

 

 

 

0

Checksum8: Includes bytes 1-5. 

 

1

Command Byte: D1111WWW 

 

 

 

Bit 7: Destination bit: 

 

 

 

0 = Local,

 

 

 

1 = Remote.

 

 

Bits 6-3: 1111 specifies that this is an extended Command. 

 

 

Bits 2-0: Used with some commands. 

2

Number of data words 

 

3

Extended command number. 

 

4

Checksum16 (LSB) 

 

5

Checksum16 (MSB) 

 

6-255

Data words.

 

 

Checksum calculations:

All checksums are a “1’s complement checksum”. Both the 8-bit and 16-bit checksum are unsigned. Sum all applicable bytes in an accumulator, 1 at a time. Each time another byte is added, check for overflow (carry bit), and if true add one to the accumulator.

In a high-level language, do the following for the 8-bit normal command checksum:

  • Get the subarray consisting of bytes 1 and up.

  • Convert bytes to U16 and sum into a U16 accumulator.

  • Divide by 28 and sum the quotient and remainder.

  • Divide by 28 and sum the quotient and remainder.

In a high-level language, do the following for an extended command 16-bit checksum:

  • Get the subarray consisting of bytes 6 and up.

  • Convert bytes to U16 and sum into a U16 accumulator (can’t overflow).

Then do the following for the 8-bit extended checksum:

  • Get the subarray consisting of bytes 1 through 5.

  • Convert bytes to U16 and sum into a U16 accumulator.

  • Divide by 28 and sum the quotient and remainder.

  • Divide by 28 and sum the quotient and remainder.

Destination Bit:

This bit specifies whether the command is destined for the local or remote target. Generally, local means the packet should be handled by the Comm processor, while remote means the Comm processor should pass the packet on. This bit is ignored on the U6 and U3.

Multi-byte parameters:

In the following function definitions there are various multi-byte parameters. The least significant byte of the parameter will always be found at the lowest byte number. For instance, bytes 10 through 13 of CommConfig are the IP address which is 4 bytes long. Byte 10 is the least significant byte (LSB), and byte 13 is the most significant byte (MSB).

Masks:

Some functions have mask parameters. The WriteMask found in some functions specifies which parameters are to be written. If a bit is 1, that parameter will be updated with the new passed value. If a bit is 0, the parameter is not changed and only a read is performed.

The AINMask found in some functions specifies which analog inputs are acquired. This is a 16-bit parameter where each bit corresponds to AIN0-AIN15. If a bit is 1, that channel will be acquired.

The digital I/O masks, such as FIOMask, specify that the passed value for direction and state are updated if a bit 1. If a bit of the mask is 0 only a read is performed on that bit of I/O.

Binary Encoded Parameters:

Many parameters in the following functions use specific bits within a single integer parameter to write/read specific information. In particular, most digital I/O parameters contain the information for each bit of I/O in one integer, where each bit of I/O corresponds to the same bit in the parameter (e.g. the direction of FIO0 is set in bit 0 of parameter FIODir). For instance, in the function ControlConfig, the parameter FIODir is a single byte (8 bits) that writes/reads the direction of each of the 8 FIO lines:

  • if FIODir is 0, all FIO lines are input,

  • if FIODir is 1 (2^0), FIO0 is output, FIO1-FIO7 are input,

  • if FIODir is 5 (2^0 + 2^2), FIO0 and FIO2 are output, all other FIO lines are input,

  • if FIODir is 255 (2^0 + … + 2^7), FIO0-FIO7 are output.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.