Campbell-scientific CR800 and CR850 Measurement and Control Systems Uživatelský manuál Strana 208

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 566
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 207
Section 7. Installation
208
Will the sensor be sending multiple data strings? Multiple strings usually
require filtering before parsing.
How fast will data be sent to the CR800?
Is power consumption critical?
Does the sensor compute a checksum? Which type? A checksum is useful to
test for data corruption.
2. Open a serial port (SerialOpen() instruction).
Example:
SerialOpen(Com1,9600,0,0,10000)
Designate the correct port in CRBasic.
Correctly wire the device to the CR800.
Match the port's baud rate to the baud rate of the device in CRBasic.
o Use a fixed baud rate (rather than autobaud) when possible.
3. Receive serial data as a string (CRBasic SerialIn() or SerialInRecord()
command).
Example:
SerialInRecord(Com2,SerialInString,42,0,35,"",01)
Declare the string variable large enough to accept the string.
o Example:
Public SerialInString As String * 25
Observe the input string in the input string variable in software numeric
monitor.
Note SerialIn() and SerialInRecord() receive the same data. SerialInRecord()
is generally used for data streaming into the CR800, while SerialIn() is used for
data that is received in discrete blocks.
4. Parse (split up) the serial string (CRBasic SplitStr() command).
Separates string into numeric and / or string variables.
Example:
SplitStr(InStringSplit,SerialInString,"",2,0)
Declare an array to accept the parsed data.
o Example:
Public InStringSplit(2) As String
o Example:
Public SplitResult(2) As Float
7.8.8.5.3 Output Programming Basics
Applications with the purpose of transmitting data to another device usually
include the following procedures. Other procedures may be required depending on
the application.
Zobrazit stránku 207
1 2 ... 203 204 205 206 207 208 209 210 211 212 213 ... 565 566

Komentáře k této Příručce

Žádné komentáře