Section 7. Installation
311
7.7.18.5.2
Serial I/O Input Programming Basics
Applications with the purpose of receiving data from another device usually
include the following procedures. Other procedures may be required depending on
the application.
1. Know what the sensor supports and exactly what the data are. Most sensors
work well with TTL voltage levels and RS-232 logic. Some things to
consider:
o
Become thoroughly familiar with the data to be captured.
o
Can the sensor be polled?
o
Does the sensor send data on its own schedule?
o
Are there markers at the beginning or end of data? Markers are very
useful for identifying a variable length record.
o
Does the record have a delimiter character such as a comma, space,
or tab? Delimiters are useful for parsing the received serial string
into usable numbers.
o
Will the sensor be sending multiple data strings? Multiple strings
usually require filtering before parsing.
o
How fast will data be sent to the CR3000?
o
Is power consumption critical?
o
Does the sensor compute a checksum? Which type? A checksum is
useful to test for data corruption.
2. Open a serial port with SerialOpen().
o
Example:
SerialOpen(Com1,9600,0,0,10000)
o
Designate the correct port in CRBasic.
o
Correctly wire the device to the CR3000.
o
Match the port baud rate to the baud rate of the device in CRBasic
(use a fixed baud rate — rather than autobaud — when possible).
3. Receive serial data as a string with SerialIn() or SerialInRecord().
—
Example:
SerialInRecord
(Com2,SerialInString,42,0,35,"",01)
o
Declare the string variable large enough to accept the string.
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: ......