Campbell Scientific CR510 Basic Datalogger User Manual

Page 178

Advertising
background image

APPENDIX B. BINARY TELECOMMUNICATIONS

B-2

User

Datalogger

Enters

Echo

K

K

CR

CR
LF
Time Minutes byte 1
Time Minutes byte 2
Time Tenths byte 1
Time Tenths byte 2
Flags byte
Ports byte (if requested)
Data1 byte 1
Data1 byte 2
Data1 byte 3
Data1 byte 4
Data2 byte 1
Data2 byte 2
Data2 byte 3
Data2 byte 4
DataN byte 1
DataN byte 2
DataN byte 3
DataN byte 4
Final Storage Data bytes
01111111 binary byte
00000000 binary byte
Signature byte 1
Signature byte 2

Time Minutes byte 1 is most significant.
Convert from binary to decimal. Divide by 60 to
get hours, the remainder is minutes. For
example, 00000001 01011001 (01 59 HEX) is
345 decimal minutes or 5:45.

Time Tenths byte 1 is most significant. Convert
from binary to decimal. Divide by 10 to get
seconds and tenths of seconds. For example,
00000001 11000110 (01 C6 HEX) is 454
decimal or 45.4 seconds. Thus the datalogger
time for 01 59 01 C6 HEX is 5:45:45.4.

The Flags byte expresses datalogger user flag
status. The most significant bit represents Flag
8, and so on to the least significant bit which
represents Flag 1. If a bit is set, the user flag is
set in the datalogger.

The optional ports byte (currently on return if
requested by a CR510 J command) expresses
the datalogger port status. The most significant
bit represents Port 8, and so on to the least
significant bit which represents Port 1.

For each input location requested by the J
command, four bytes of data are returned. The
bytes are coded in Campbell Scientific, Inc.
Floating Point Format. The format is decoded
to the following:

Sign(Mantissa*2

(Exponent)

)

Data byte 1 contains the Sign and the
Exponent. The most significant bit represents
the Sign; if zero, the Sign is positive, if one, the
Sign is negative. The signed exponent is
obtained by subtracting 40 HEX (or 64 decimal)
from the 7 remaining least significant bits.

Data bytes 2 to 4 are a binary representation of
the mantissa with byte 2 the most significant and
4 the least. The mantissa ranges in value from
80 00 00 hex (0.5 decimal) to FF FF FF HEX
(1-2

-24

decimal). The one exception is for zero

which is 00 00 00 00 HEX.

The Mantissa is calculated by converting Data
bytes 2 to 4 into binary. Each bit represents
some fractional value which is summed for all
24 bits. The bits are arranged from MSB to
LSB with the most significant as bit

23

and least

significant as bit

0

. The value that each bit

represents = 2

n-24

; where n=bit location. For

example, if there was a 1 at bit

20

, it’s value

would be 2

(20-24)

or 2

-4

.

A simple method for programming this is as
follows:

Set Mantissa = 0.

Set Bit Value = 0.5.

For loop count = 1 to 24 do the following:

If the MSB is one, then add Bit Value to the
Mantissa.

Shift the 24 bit binary value obtained from
Data bytes 2 to 4 one bit to the left.

Multiply Bit Value by 0.5.

End of loop.

Another method that can be used as an
estimate is to convert Data bytes 2 to 4 from a
long integer to floating point and dividing this
value by 16777216.

Advertising