Section 7. Installation
CRBasic Example 53.
Receiving an RS-232 String
'This program example demonstrates CR1000 serial I/O features by:
' 1. Simulating a serial sensor
' 2. Transmitting a serial string via COM1 TX.
'The serial string is received at COM2 RX via jumper wire. Simulated
'air temperature = 27.435 F, relative humidity = 56.789 %.
'Wiring:
'COM1 TX (C1) ----- COM2 RX (C4)
'Serial Out Declarations
Public
TempOut
As Float
Public
RhOut
As Float
'Declare a string variable large enough to hold the output string.
Public
SerialOutString
As String
* 25
'Serial In Declarations
'Declare a string variable large enough to hold the input string
Public
SerialInString
As String
* 25
'Declare strings to accept parsed data. If parsed data are strictly numeric, this
'array can be declared as Float or Long
Public
InStringSplit(2)
As String
Alias
InStringSplit(1) = TempIn
Alias
InStringSplit(2) = RhIn
'Main Program
BeginProg
'Simulate temperature and RH sensor
TempOut = 27.435
'Set simulated temperature to transmit
RhOut = 56.789
'Set simulated relative humidity to transmit
Scan
(5,Sec, 3, 0)
'Serial Out Code
'Transmits string "*27.435,56.789#" out COM1
SerialOpen
(Com1,9600,0,0,10000)
'Open a serial port
'Build the output string
SerialOutString = "*" & TempOut & "," & RhOut & "#"
'Output string via the serial port
SerialOut
(Com1,SerialOutString,"",0,100)
'Serial In Code
'Receives string "27.435,56.789" via COM2
'Uses * and # character as filters
SerialOpen
(Com2,9600,0,0,10000)
'Open a serial port
255
Summary of Contents for CR1000
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 40: ......
Page 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Page 96: ......
Page 98: ...98 ...
Page 302: ......
Page 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Page 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Page 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Page 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Page 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Page 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Page 478: ......
Page 506: ......
Page 536: ......
Page 636: ......
Page 642: ......
Page 644: ......
Page 676: ......
Page 677: ......