beautypg.com

Define data tables constants, Setup main program scan – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 133

background image

Section 4. CRBasic – Native Language Programming

7) Know your DATA STORAGE. Read Section 4.2.8. Define the Data

Tables and the data that will be stored in them. Can have multiple data
tables with the same or different storage rates. It is recommended to store
all final data on PCMCIA memory cards. Label the Data Tables.

‘Define Data Tables Constants

DataTable (Temps,1,-1)
CardOut
(0 ,-1)
DataInterval

(0,100,mSec,10)

Sample

(1,RefTemp,IEEE4)

Sample

(3,TC(),IEEE4)

EndTable

DataTable
(Pressure,1,-1)
CardOut (0 ,-1)
DataInterval

(0,10,mSec,10)

Sample

(2,Press(),IEEE4)

EndTable

8) Know your MEASUREMENT RATE. Read 4.2.9.1. Define the

measurement rate using the Scan instruction. The rate must be at least as
fast as the highest measurement storage rate required (100 Hz or 10
milliseconds for our example case). Must call the Data Tables from the
running Scan in order to process the measured values.

‘Setup Main Program Scan

BeginProg
Scan

(10,mSec,0,0)

CallTable

Temps

CallTable

Pressure

NextScan
EndProg

9) Know your MEASUREMENT INSTRUCTIONS. Read Section 4.2.10

for information on thermocouple measurements and for an example of a
simple program. Read Section 7.4 for information on Full Bridge
measurements. Section 7 covers other measurement types as well. Do not
forget that thermocouple measurements require a reference junction
temperature measurement (use the ModuleTemp instruction).

‘Setup Main Program Scan

BeginProg
Scan

(10,mSec,0,0)

ModuleTemp

(RefTemp,1,4,0)

TCDiff

(TC(),3,mV50C,4,1,TypeK,RefTemp,True ,40,100, TCMult,TCOffset)

BrFull

(Press(1),1,mV50,4,4,5,7,1,5000,True ,True ,30,100,P1Mult,P1Offset)

BrFull

(Press(2),1,mV50,4,4,5,7,1,5000,True ,True ,30,100,P2Mult,P2Offset)

CallTable Temps
CallTable

Pressure

NextScan
EndProg

4-5