Data format in energy mode – Gentec-EO M-LINK User Manual

Page 39

Advertising
background image

M-

LINK User’s Manual Revision 3.0

33

3.2.6 Data Format in Energy Mode

The M-LINK sends 7 bytes in Energy Mode. The data is terminated by a carriage return, so a carriage
return must not be sent inadvertently. As M-LINK is building the data byte, it checks to see if the byte is a
carriage return. If it is, it decrements it by one and sets a bit in a byte called the correction byte. The
correction byte is structured so that it is always an even value, therefore it can never be a carriage return.
This byte is sent after the 5 data bytes, and then the carriage return is sent.

Byte 1 is the upper 8 bits of the pulse data.

Byte 2 is the lower 4 bits of the pulse data and the upper 4 bits of the range index.

Byte 3 is the lower 4 bits of the range and the upper 4 bits of the period counts.

Bytes 4 and 5 are the remaining 16 bits of the period counts, twenty bits total.

Byte 6 is the correction byte

Byte 7 is the carriage return.

Example with no byte corrections:

The data is 0xA711F01EC2000D

0xA7 byte 6

0x11 byte 5

0xF0 byte 4

0x1E byte 3

0xC2 byte 2

0x00 byte 1, the correction byte

0x0D byte 0, carriage return.

All the following is done in the host application

Byte 1 is the correction byte and is interpreted as follows:

Bit0 is not used, always set to 0

Bit1 set, increment byte 2 by 1, not set, byte 2 is ok

Bit2 set, increment byte 3 by 1, not set, byte 3 is ok

Bit3 set, increment byte 4 by 1, not set, byte 4 is ok

Bit4 set, increment byte 5 by 1, not set, byte 5 is ok

Bit5 set, increment byte 6 by 1, not set, byte 6 is ok

Bit6 set, the ADC returned 0 Counts, ambiguous data

Advertising