Instruction Manual
19
7. CRBasic Programming
The CR1000 uses a programming language that has similarities to structured
BASIC, hence the name CRBasic. Within CRBasic there are special instructions
for making various measurements and for defining tables of output data.
Measured results are assigned variable names. Mathematical operations are
written out much as they would be algebraically. Conditional statements based on
measured results provide users with extensive capability for measurement and
control applications. See Section 8 for details on individual instructions.
Appendix F contains some example CRBasic programs for the CS110. A simple
example CRBasic program illustrating some of the general concepts follows:
'Comments can be inserted in CRBasic utilizing a single quote (').
'Simple CS110 program that measures panel (case) temperature, internal case
'relative humidity, battery voltage and electric field.(CS110_Simple.cr1).
'Updated last by Jody Swenson on 7/12/04.
const Mult = 85
'Define constant to be used in the program.
Public panel_temp
'Define variables to be used in the program.
Public internal_RH
Public battery_volt
Public E_field
Public leakage_cur
Public status
DataTable(Tab1,1,500)
'User defined table called Tab1 of size 500 records.
DataInterval(0,60,sec,10)
'Output data to the table processed every 60 seconds.
Average
(1,panel_temp,ieee4,0)
'Average panel temperature over interval.
Average
(1,internal_RH,ieee4,0)
'Average internal case RH.
Average
(1,battery_volt,ieee4,0)
'Use 4 byte ieee4 format for wide dynamic range.
Average(1,E_field,ieee4,0)
StdDev
(1,E_field,ieee4,0)
Average
(1,leakage_cur,ieee4,0)
Maximum
(1,status,ieee4,0,False)
EndTable
BeginProg
Scan(1,sec,0,0)
'Scan loop occurring every second.
PanelTemp
(panel_temp,250)
'Measure temperature on CS110 panel board.
VoltDiff
(internal_RH,1,mV2500,5,True
,0,250,0.1,0)
Battery
(battery_volt)
'Measure CS110 battery voltage.
CS110(E_field,leakage_cur,status,_60Hz,Mult,0)
'CS110 electric field measurement.
CallTable
Tab1
'Call data table Tab1 every scan.
NextScan
EndProg
Public variables are defined and available for viewing in the
Public
table, which is
a data table automatically set up by the CR1000. The
Public
table keeps only the
current value of each of the defined variables.
In the example program, the
DataTable
instruction is used to define the data table
Tab1
. A record in a table consists of the data from all output processing
instructions, along with a record number and time stamp data. Using -1 for last
parameter in
DataTable
results in the automatic allocation of all available table
storage area. The
DataInterval
instruction following the
DataTable
instruction
defines the interval at which new values are determined and written into the table,
which is every 60 seconds in the above example. Once a table is full the CR1000
writes new values over the top of old values starting with the oldest data in the
Содержание CS110
Страница 2: ......
Страница 4: ......
Страница 6: ......
Страница 10: ...iv This is a blank page ...
Страница 37: ...Instruction Manual 27 ...
Страница 48: ......
Страница 52: ...Appendix B CS110 Accessories This is a blank page B 2 ...
Страница 56: ...Appendix C CS110 Connector Pin outs C 4 This is a blank page ...
Страница 72: ...Appendix F Example CRBasic Programs This is a blank page F 4 ...
Страница 78: ...Appendix G CS110 2 Metre CM10 Tripod Site This is a blank page G 6 ...
Страница 85: ......