EasyManuals Logo

Campbell CR850 User Manual

Campbell CR850
566 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #211 background imageLoading...
Page #211 background image
Section 7. Installation
211
the sensor sends multiple strings at once, consider declaring a single string
variable and read incoming strings one at a time.
TheCR800adjuststhedeclaredsizeofstrings.Onebyteisalwaysadded
tothedeclaredlength,whichisthenincreasedbyuptoanotherthree
bytestomakelengthdivisiblebyfour.
Declaredstringlength,notnumberofcharacters,determinesthe
memoryconsumedwhenstringsarewrittentomemory.Consequ
ently,
largestringsnotfilledwithcharacterswastesignificantmemory.
7.8.8.5.6 Demonstration Program
CRBasic example Receiving an RS-232 String
(p. 211) is provided as an exercise in
serial input / output programming. The example only requires the CR800 and a
single wire jumper between COM1 Tx and COM2 Rx. The program simulates a
temperature and relative humidity sensor transmitting RS-232 (simulated data
comes out of COM1 as an alpha-numeric string).
CRBasicExample40. ReceivinganRS232String
'To demonstrate CR800 Serial I/O features, this program simulates a serial sensor
'by 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

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Campbell CR850 and is the answer not in the manual?

Campbell CR850 Specifications

General IconGeneral
BrandCampbell
ModelCR850
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals