Section 7. Installation
314
•
Binary — Bytes are processed on a bit-by-bit basis. Character 0 (Null,
&b00) is a valid part of binary data streams. However, the CR3000 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.18.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. 539).
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 CR3000 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.
Summary of Contents for CR3000 Micrologger
Page 2: ......
Page 3: ......
Page 4: ......
Page 6: ......
Page 30: ......
Page 34: ......
Page 36: ......
Page 96: ......
Page 485: ...Section 8 Operation 485 8 11 2 Data Display FIGURE 110 Keyboard and Display Displaying Data ...
Page 487: ...Section 8 Operation 487 FIGURE 112 CR1000KD Real Time Custom ...
Page 491: ...Section 8 Operation 491 FIGURE 116 Keyboard and Display File Edit ...
Page 496: ......
Page 502: ......
Page 564: ...Section 11 Glossary 564 FIGURE 126 Relationships of Accuracy Precision and Resolution ...
Page 566: ......
Page 594: ......
Page 598: ......
Page 600: ......
Page 602: ......
Page 624: ......
Page 642: ......
Page 643: ......