Data logger programming
This section provides programming information for the GRANITE-series (≥OS 1), CR6 (≥OS 10), CR1000X (≥OS 4), and CR300-series (≥OS 10), data loggers. For information on programming the CR3000, CR800-series, and CR1000 data loggers, refer to TX321 program converted to TX325 program (CR1000, CR3000, CR800-series) and the example program at www.campbellsci.com/downloads/tx325-example-program-cr3000-cr1000- cr800 or contact Campbell Scientific.
The CRBasic program can read and enter TX325 settings. Settings can also be entered using the Device Configuration Utility (see QuickStart). Read and write TX325 settings provides the TX325 settings that can be read and entered. Read-only TX325 settings provides the read-only settings.
The CRBasic program should include the GOESTable()
and GOESField()
instructions used in conjunction with the DataTable()
instruction to facilitate the transmission of data across the GOES satellite network. The GOESTable()
instruction has the following syntax:
GOESTable
(Result, ComPort, Model, BufferControl, Fields_Scan_Order,Newest_First,Format)
The Result
is a string variable that holds either the data to be output in its specified format or a message indicating there are no data to output to the transmitter. For the Model
, enter 3 to use the TX325. For the BufferControl
, a value of 0 writes to the self-timed buffer and a value of 1 writes to the random buffer. Data formats and transmission durations discusses the Format
options.
The GOESField()
instruction has the following syntax:
GOESField
(NumVals, Decimation, Precision, Width, SHEF)
The NumVals
is the number of historical values of the field to output. For Decimation
, enter 1 to output every value, enter 2 to output every other value, etc. Width
specifies the number of characters in the field. Use empty quotes ("") for SHEF
1 if no SHEF code is specified.
An example of using the the GOESTable()
and GOESField()
instructions follows:
DataTable
(ST_DATA, TRUE, -1)
DataInterval
(0, 15, Min, 4)
GOESTable
(st_table_results, COMRS232, 3, 0, TRUE, TRUE, 3)
GOESField
(4, 1, 3, 6, ""
)
Sample
(1, battery_voltage, IEEE4)
GOESField
(4, 1, 3, 6, ""
)
Sample
(1, panel_temperature, IEEE4)
EndTable
In the main portion of the program, settings are written using SetSetting()
instruction with the following the syntax:
SetSetting
( "FieldName"
, Value )
The FieldName
must be enclosed in quotes as shown. The following example instruction sets the port used to communicate with the TX325 to the RS-232 port:
SetSetting
(“GOESComPort”
, COMRS232)
The CRBasic program reads the TX325 settings using the following format:
Variable = Settings.FieldName
For example, goes_comport = Settings.GOESComPort
reads the Com port setting and stores it in the GOESComPort
variable. The TX325 settings are typically read in a SlowSequence
section of the program. Read and write TX325 settings provides the TX325 settings that can be set and read. Read-only TX325 settings provides the read-only settings.
A downloadable example program is available at: www.campbellsci.com/downloads/tx325-example-program-granite-cr6-cr1000x-cr300 .