beautypg.com

4 communications, 1 rs-232, Crbasic example 69. using nan to filter data – Campbell Scientific CR1000 Measurement and Control System User Manual

Page 431

background image

Section 10. Troubleshooting

431

 

CRBasic Example 69. Using NAN to Filter Data 

'Declare Variables and Units

Public

TC_RefC

Public

TC_TempC

Public

DisVar

As Boolean

'Define Data Tables

DataTable

(TempC_Data,True,-1)

DataInterval

(0,30,Sec,10)

Average

(1,TC_TempC,FP2,DisVar)

'Output process

EndTable

'Main Program

BeginProg

Scan

(1,Sec,1,0)

'Measure Thermocouple Reference Temperature

PanelTemp

(TC_RefC,250)

'Measure Thermocouple Temperature

TCDiff

(TC_TempC,1,mV20,1,TypeT,TC_RefC,True,0,250,1.0,0)

'DisVar Filter

If

TC_TempC = NAN

Then

DisVar = True

Else

DisVar = False

EndIf

'Call Data Tables and Store Data

CallTable

(TempC_Data)

NextScan

EndProg

 

10.4 Communications

10.4.1 RS-232

Baud rate mis-match between the CR1000 and datalogger support software is
often the root of communication problems through the RS-232 port. By default,
the CR1000 attempts to adjust its baud rate to that of the software. However,
settings changed in the CR1000 to accommodate a specific RS-232 device, such
as a smart sensor, display or modem, may confine the RS-232 port to a single
baud rate. If the baud rate can be guessed at and entered into support software
parameters, communications may be established. Once communications is
established, CR1000 baud rate settings can be changed. Clues as to what the baud
rate may be set at can be found by analyzing current and previous CR1000
programs for the SerialOpen() instruction; SerialOpen() specifies a baud rate.
Documentation provided by the manufacturer of the previous RS-232 device may
also hint at the baud rate.