Section 7. Installation
3. Output string via the serial port (
SerialOut()
or
SerialOutBlock()
command).
o
Example:
SerialOut
(Com1,SerialOutString,"",0,100)
o
Declare the output string variable large enough to hold the entire
concatenation.
o
Example:
Public
SerialOutString
As String
* 100
•
SerialOut()
and
SerialOutBlock()
output the same data, except that
SerialOutBlock()
transmits null values while
SerialOut()
strings are
terminated by a null value.
7.9.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. 251)
). 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
CR1000 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 CR1000 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.9.17.5.5 Serial I/O Memory Considerations
Several points regarding memory should be considered when receiving and
processing serial data.
253
Summary of Contents for CR1000
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 40: ......
Page 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Page 96: ......
Page 98: ...98 ...
Page 302: ......
Page 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Page 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Page 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Page 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Page 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Page 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Page 478: ......
Page 506: ......
Page 536: ......
Page 636: ......
Page 642: ......
Page 644: ......
Page 676: ......
Page 677: ......