Section 7.  Installation 
 
 
Note Concerning SerialInRecord() running in pipeline mode with 
NBytes (number of bytes) parameter = 0: 
For the digital measurement sequence to know how much room to allocate 
in Scan() buffers (default of 3), SerialInRecord() allocates the buffer size 
specified by SerialOpen() (default 10,000, an overkill), or default 3 • 
10,000 = 30 kB of buffer space.    So, while making sure enough bytes are 
allocated in SerialOpen() (the number of bytes per record • 
((records/Scan)+1) + at least one extra byte), there is reason not to make 
the buffer size too large.    (Note that if the NumberOfBytes parameter is 
non-zero, then SerialInRecord() allocates only this many bytes instead of 
the number of bytes specified by SerialOpen()). 
•  Variable Declarations — Variables used to receive data from the serial 
buffer can be declared as Public or Dim.  Declaring variables as Dim 
has the effect of consuming less comms bandwidth.    When public 
variables are viewed in software, the entire Public table is transferred at 
the update interval.    If the Public table is large, comms bandwidth can 
be taxed such that other data tables are not collected. 
•  String Declarations — String variables are memory intensive.   
Determine how large strings are and declare variables just large enough 
to hold the string.    If the sensor sends multiple strings at once, consider 
declaring a single string variable and read incoming strings one at a time. 
The CR800 adjusts upward the declared size of strings.    One byte is always 
added to the declared length, which is then increased by up to another three 
bytes to make the length divisible by four. 
Declared string length, not number of characters, determines the memory 
consumed when strings are written to memory.    Consequently, large strings 
not filled with characters waste significant memory. 
 
7.7.17.5.6  Serial I/O Example I 
CRBasic example Receiving an RS-232 String (p. 290) is provided as an exercise in 
serial input / output programming.    The example only requires the CR800 and a 
single-wire jumper between COM1 Tx and COM2 Rx. The program simulates a 
temperature and relative humidity sensor transmitting RS-232 (simulated data 
comes out of COM1 as an alpha-numeric string).