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.
Содержание CR3000 Micrologger
Страница 2: ......
Страница 3: ......
Страница 4: ......
Страница 6: ......
Страница 30: ......
Страница 34: ......
Страница 36: ......
Страница 96: ......
Страница 200: ...Section 7 Installation 200 FIGURE 42 Running Average Frequency Response FIGURE 43 Running Average Signal Attenuation ...
Страница 485: ...Section 8 Operation 485 8 11 2 Data Display FIGURE 110 Keyboard and Display Displaying Data ...
Страница 487: ...Section 8 Operation 487 FIGURE 112 CR1000KD Real Time Custom ...
Страница 488: ...Section 8 Operation 488 8 11 2 3 Final Storage Data FIGURE 113 Keyboard and Display Final Storage Data ...
Страница 489: ...Section 8 Operation 489 8 11 3 Run Stop Program FIGURE 114 Keyboard and Display Run Stop Program ...
Страница 491: ...Section 8 Operation 491 FIGURE 116 Keyboard and Display File Edit ...
Страница 495: ...Section 8 Operation 495 Low power standby whenever possible Low power bus sets bus and modules to low power ...
Страница 496: ......
Страница 502: ......
Страница 564: ...Section 11 Glossary 564 FIGURE 126 Relationships of Accuracy Precision and Resolution ...
Страница 566: ......
Страница 594: ......
Страница 598: ......
Страница 600: ......
Страница 602: ......
Страница 624: ......
Страница 642: ......
Страница 643: ......