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.
Содержание 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: ......