Section 7. Installation
289
7.7.17.5.4 Serial I/O Translating Bytes
One or more of three principle data formats may end up in the
SerialInString()
variable (see examples in
Serial Input Programming Basics
(p. 286)
). Data may be
combinations or variations of these. The instrument manufacturer must provide
the rules for decoding the data
•
Alpha-numeric
— Each digit represents an alpha-numeric value. For
example, R = the letter R, and 2 =
decimal 2. This is the easiest
protocol to translate since the encode and translation are identical.
Normally, the CR800 is programmed to parse (split) the string and place
values in variables.
Example string from humidity, temperature, and pressure sensor:
SerialInString
= "RH= 60.5 %RH T= 23.7 °C Tdf= 15.6 °C Td=
15.6 °C a= 13.0 g/m3 x= 11.1 g/kg Tw= 18.5 °C H2O=
17889 ppmV pw=17.81 hPa pws 29.43 hPa h= 52.3 kJ/kg dT=
8.1 °C"
•
Hex Pairs
— Bytes are translated to hex pairs, consisting of digits 0 to 9
and letters a to f. Each pair describes a hexadecimal ASCII / ANSI code.
Some codes translate to alpha-numeric values, others to symbols or non-
printable control characters.
Example sting from temperature sensor:
SerialInString
= "23 30 31 38 34 0D"
which translates to
#01 84 cr
•
Binary
— Bytes are processed on a bit-by-bit basis. Character 0 (Null,
&b00) is a valid part of binary data streams. However, the CR800 uses
Null terminated strings, so anytime a Null is received, a string is
terminated. The termination is usually premature when reading binary
data. To remedy this problem, use
SerialInBlock()
or
SerialInRecord()
when reading binary data. The input string variable
must be an array set
As Long
data type, for example:
Dim
SerialInString
As Long
7.7.17.5.5 Serial I/O Memory Considerations
Several points regarding memory should be considered when receiving and
processing serial data.
•
Serial buffer:
The serial port buffer, which is declared in
SerialOpen()
,
must be large enough to hold all data a device will send. The buffer
holds the data for subsequent transfer to variables. Allocate extra
memory to the buffer when needed, but recognize that memory added to
the buffer reduces
final-data memory
(p. 499).
Summary of Contents for CR800 Series
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 34: ......
Page 54: ......
Page 92: ......
Page 310: ......
Page 446: ...Section 8 Operation 446 8 11 2 Data Display FIGURE 100 CR1000KD Displaying Data ...
Page 448: ...Section 8 Operation 448 FIGURE 102 CR1000KD Real Time Custom ...
Page 449: ...Section 8 Operation 449 8 11 2 3 Final Storage Data FIGURE 103 CR1000KD Final Storage Data ...
Page 450: ...Section 8 Operation 450 8 11 3 Run Stop Program FIGURE 104 CR1000KD Run Stop Program ...
Page 452: ...Section 8 Operation 452 FIGURE 106 CR1000KD File Edit ...
Page 456: ......
Page 462: ......
Page 523: ...Section 11 Glossary 523 FIGURE 116 Relationships of Accuracy Precision and Resolution ...
Page 524: ......
Page 526: ......
Page 556: ......
Page 558: ......
Page 560: ......
Page 597: ......