CR 300
CR 300
CR 300
CR300-Series Datalogger
Revision: 1/17
C o p y r i g h t 2 0 1 6 - 2 0 1 7
C a m p b e l l S c i e n t i f i c , I n c .
Limited Warranty
The CR300 Datalogger is warranted for three (3) years subject to this limited
warranty:
For all returns, the customer must fill out a Statement of Product Cleanliness
and Decontamination form and comply with the requirements specified in it.
The form is available from our website at www.campbellsci.com/repair. A
completed form must be either emailed to repair@campbellsci.com or faxed to
(435) 227-9106. Campbell Scientific is unable to process any returns until we
receive this form. If the form is not received within three days of product
receipt or is incomplete, the product will be returned to the customer at the
customers expense. Campbell Scientific reserves the right to refuse service on
products that were exposed to contaminants that may cause health or safety
concerns for our employees.
Safety
DANGER MANY HAZARDS ARE ASSOCIATED WITH INSTALLING, USING, MAINTAINING, AND WORKING ON OR AROUND
TRIPODS, TOWERS, AND ANY ATTACHMENTS TO TRIPODS AND TOWERS SUCH AS SENSORS, CROSSARMS, ENCLOSURES,
ANTENNAS, ETC. FAILURE TO PROPERLY AND COMPLETELY ASSEMBLE, INSTALL, OPERATE, USE, AND MAINTAIN TRIPODS,
TOWERS, AND ATTACHMENTS, AND FAILURE TO HEED WARNINGS, INCREASES THE RISK OF DEATH, ACCIDENT, SERIOUS
INJURY, PROPERTY DAMAGE, AND PRODUCT FAILURE. TAKE ALL REASONABLE PRECAUTIONS TO AVOID THESE HAZARDS.
CHECK WITH YOUR ORGANIZATION'S SAFETY COORDINATOR (OR POLICY) FOR PROCEDURES AND REQUIRED PROTECTIVE
EQUIPMENT PRIOR TO PERFORMING ANY WORK.
Use tripods, towers, and attachments to tripods and towers only for purposes for which they are designed. Do not exceed design limits.
Be familiar and comply with all instructions provided in product manuals. Manuals are available at www.campbellsci.com or by
telephoning (435) 227-9000 (USA). You are responsible for conformance with governing codes and regulations, including safety
regulations, and the integrity and location of structures or land to which towers, tripods, and any attachments are attached. Installation
sites should be evaluated and approved by a qualified engineer. If questions or concerns arise regarding installation, use, or
maintenance of tripods, towers, attachments, or electrical connections, consult with a licensed and qualified engineer or electrician.
General
Prior to performing site or installation work, obtain required approvals and permits. Comply
with all governing structure-height regulations, such as those of the FAA in the USA.
Use only qualified personnel for installation, use, and maintenance of tripods and towers, and
any attachments to tripods and towers. The use of licensed and qualified contractors is highly
recommended.
Read all applicable instructions carefully and understand procedures thoroughly before
beginning work.
Wear a hardhat and eye protection, and take other appropriate safety precautions while
working on or around tripods and towers.
Do not climb tripods or towers at any time, and prohibit climbing by other persons. Take
reasonable precautions to secure tripod and tower sites from trespassers.
Use only manufacturer recommended parts, materials, and tools.
Utility and Electrical
You can be killed or sustain serious bodily injury if the tripod, tower, or attachments you are
installing, constructing, using, or maintaining, or a tool, stake, or anchor, come in contact with
overhead or underground utility lines.
Maintain a distance of at least one-and-one-half times structure height, 20 feet, or the distance
required by applicable law, whichever is greater, between overhead utility lines and the
structure (tripod, tower, attachments, or tools).
Prior to performing site or installation work, inform all utility companies and have all
underground utilities marked.
Comply with all electrical codes. Electrical equipment and related grounding devices should be
installed by a licensed and qualified electrician.
Elevated Work and Weather
Exercise extreme caution when performing elevated work.
Use appropriate equipment and safety practices.
During installation and maintenance, keep tower and tripod sites clear of un-trained or non-
essential personnel. Take precautions to prevent elevated tools and objects from dropping.
Do not perform any work in inclement weather, including wind, rain, snow, lightning, etc.
Maintenance
Periodically (at least yearly) check for wear and damage, including corrosion, stress cracks,
frayed cables, loose cable clamps, cable tightness, etc. and take necessary corrective actions.
Periodically (at least yearly) check electrical ground connections.
WHILE EVERY ATTEMPT IS MADE TO EMBODY THE HIGHEST DEGREE OF SAFETY IN ALL CAMPBELL SCIENTIFIC PRODUCTS,
THE CUSTOMER ASSUMES ALL RISK FROM ANY INJURY RESULTING FROM IMPROPER INSTALLATION, USE, OR
MAINTENANCE OF TRIPODS, TOWERS, OR ATTACHMENTS TO TRIPODS AND TOWERS SUCH AS SENSORS, CROSSARMS,
ENCLOSURES, ANTENNAS, ETC.
Table of Contents
PDF viewers: These page numbers refer to the printed version of this document. Use the
PDF reader bookmarks tab for links to specific sections.
1. Introduction ................................................................ 1
2. Precautions ................................................................ 1
4. QuickStart ................................................................... 2
4.1 Configure Software .............................................................................. 3
4.2 Connect to the CR300 .......................................................................... 8
4.2.1 Connect with PC200W or PC400 ................................................. 8
4.2.2 Connect with LoggerNet ............................................................... 9
4.3 Create a Program................................................................................ 10
4.4 Wire Sensors and Devices .................................................................. 14
4.5 Send a Program .................................................................................. 15
4.6 Collect Data ....................................................................................... 16
4.6.1 Collect Data with PC200W or PC400......................................... 16
4.6.2 Collect Data with LoggerNet ...................................................... 17
4.7 View Data .......................................................................................... 18
4.8 Install the CR300 ............................................................................... 18
4.9 Apply Power ...................................................................................... 19
4.10 Connect to Earth Ground ................................................................... 19
5. Overview ................................................................... 20
5.1 Wiring Panel Overview ...................................................................... 20
5.2 Configuring the CR300 ...................................................................... 21
5.2.1 Device Configuration Utility....................................................... 21
5.2.2 Network Planner ......................................................................... 21
5.3 Configuring Datalogger Support Software ........................................ 22
5.4 Writing a Program.............................................................................. 22
5.5 Sending a Program ............................................................................. 22
5.6 Monitoring Data ................................................................................. 23
5.7 Collecting Data .................................................................................. 23
5.8 Viewing Data ..................................................................................... 23
6. Details ....................................................................... 26
6.1 Analog Measurements........................................................................ 26
6.1.1 Voltage Measurements................................................................ 26
6.1.1.1 Single-Ended Measurements ............................................ 26
6.1.1.2 Differential Measurements ............................................... 27
6.1.1.3 Voltage Ranges ................................................................ 27
6.1.1.4 Settling Time .................................................................... 27
6.1.1.5 Reverse Differential ......................................................... 27
6.1.1.6 First Notch Frequency ...................................................... 27
6.1.2 Resistance Measurements ........................................................... 28
6.1.2.1 Voltage Excitation ............................................................ 30
i
Table of Contents
7. Specifications ........................................................... 42
7.1 Voltage Measurements ...................................................................... 42
7.2 Resistance Measurements.................................................................. 44
7.3 Voltage Excitation ............................................................................. 44
7.4 Current Measurements ...................................................................... 45
7.5 Pulse Measurements .......................................................................... 45
7.5.1 Switch-Closure Input ................................................................. 45
7.5.2 High-Frequency Input ................................................................ 45
7.5.3 Low-Level AC Input .................................................................. 46
7.6 Period Averaging............................................................................... 46
7.7 Digital Input/Output .......................................................................... 46
7.8 Switched Voltage Output .................................................................. 47
7.9 Pulse-Width Modulation ................................................................... 48
7.10 Communication ................................................................................. 48
7.11 System ............................................................................................... 48
7.12 Power Requirements ......................................................................... 49
7.13 Compliance ....................................................................................... 50
7.14 Physical ............................................................................................. 50
7.15 CR310 Ethernet Communication ...................................................... 50
7.16 RF407, RF412, and RF422 Radio Options........................................ 51
7.17 WIFI Option ...................................................................................... 51
ii
Table of Contents
8. Maintenance ............................................................. 52
8.1 Calibration.......................................................................................... 52
8.2 Sending an Operating System ............................................................ 52
8.3 Internal Lithium Battery..................................................................... 53
9. Troubleshooting ....................................................... 53
9.1 Station Status ..................................................................................... 53
9.2 Basic Troubleshooting Procedure ...................................................... 55
9.3 NAN and INF ..................................................................................... 56
9.4 Out of Memory Error ......................................................................... 57
9.5 Resetting the CR300 .......................................................................... 57
iii
Table of Contents
Figures
4-1. Opening a Terminal on CR300 models ............................................. 14
4-2. Mounting to a Backplate ................................................................... 19
5-1. CR300 (right) and CR310 (left) wiring panels .................................. 20
6-1. CR300 Current Measurement ............................................................ 31
6-2. Pulse Signal Types ............................................................................ 33
6-3. Lightning Protection Scheme ............................................................ 40
9-1. Station Status Window ...................................................................... 54
Tables
5-1. CR300 Wiring Panel Terminal Definitions ....................................... 20
5-2. Typical Data Table ............................................................................ 24
5-3. TOA5 Environment Line................................................................... 24
5-4. Data Process Abbreviations............................................................... 25
6-1. Resistive-Bridge Circuits with Voltage Excitation............................ 28
6-2. 020 mA and 420 mA Sensor Example Connections ..................... 31
6-3. Pulse Measurement Input Types, Terminals, and Data Options....... 33
6-4. Power LED Activity .......................................................................... 41
7-1. Analog Voltage Measurement Range and Resolution ....................... 43
7-2. Analog Voltage Measurement Accuracy Offsets .............................. 43
7-3. Analog Voltage Measurement Speed ................................................ 44
7-4. Analog Voltage Measurement Input Resistance and Current ............ 44
7-5. Low-Level AC Ranges ...................................................................... 46
7-6. Digital I/O Voltage Levels ................................................................ 47
7-7. SW12V Thermal Fuse Hold Current ................................................. 47
7-8. Memory Size and Allocation ............................................................. 49
9-1. Troubleshooting with Station Status ................................................. 55
A-1. Ethernet Port LED Activity ............................................................. A-6
iv
Table of Contents
CRBasic Examples
9-1. Restarting the CR300 Under Program Control .................................. 58
E-1. CRBasic Program Structure ............................................................. E-2
E-2. Inserting Comments ......................................................................... E-3
E-3. Variable Data Type Declarations ..................................................... E-5
E-4. Using a Variable Array in Calculations ........................................... E-6
E-5. Using SetSettings to Preserve Variables .......................................... E-7
E-6. Definition and Use of a Data Table.................................................. E-8
E-7. Use of the Disable Variable ........................................................... E-13
E-8. Measurement Instruction Syntax.................................................... E-14
v
Table of Contents
vi
CR300-Series Datalogger
1. Introduction
The CR300 series are multipurpose, compact, low-cost measurement and
control dataloggers. These entry level dataloggers, with their rich instruction
sets, can measure most hydrological, meteorological, environmental, and
industrial sensors. They can concentrate data, making it available over varied
networks, and deliver it using your preferred protocol. The CR300 series also
performs automated on-site or remote decision making for control and mobile-
to-mobile communications. This manual provides a detailed look at the
CR300-series measurement and control dataloggers and discusses the steps
necessary to begin using it in your application.
To the basic design of the CR300, the CR310 version adds an Ethernet port and
removable terminals. Both models can include radio (RF407, RF412, or
RF422) or Wi-Fi (WIFI) communication options.
Throughout this manual, any reference to the CR300 also applies to every
CR300-series datalogger, unless specifically noted.
2. Precautions
READ AND UNDERSTAND the Safety section at the front of this manual.
WARNING:
1
CR300-Series Datalogger
Note for RF407 and RF412 radio options: This equipment has been tested and
found to comply with the limits for a Class A digital device, pursuant to part 15
of the FCC Rules. These limits are designed to provide reasonable protection
against harmful interference when the equipment is operated in a commercial
environment. This equipment generates, uses, and can radiate radio frequency
energy and, if not installed and used in accordance with the instruction manual,
may cause harmful interference to radio communications. Operation of this
equipment in a residential area is likely to cause harmful interference in which
case the user will be required to correct the interference at his or her own
expense.
3. Initial Inspection
The CR300 ships with the following items:
Calibration Certificate
USB cable to connect the CR300 to a PC
Preloaded datalogger program that measures power-supply voltage
and processing board temperature.
Screwdriver for connecting wires to terminals
3 nylon anchors with 3 screws to mount the CR300 in an enclosure
Upon receipt of the CR300, inspect the packaging and contents for damage.
File damage claims with the shipping company.
Check the operating system version in the CR300 as outlined in Section 8.2,
Sending an Operating System (p. 52), and update as needed.
4. QuickStart
This section discusses the basic steps of setting up a CR300 and datalogger
support software (p. 58).
2
CR300-Series Datalogger
TUTORIAL
Follow these steps for a tutorial on basic CR300 procedures. Following these
steps, you will:
Create a program for the CR300 to measure the voltage of its power
supply, its internal temperature, and a thermocouple. It will measure
every second and record an average of each measurement every minute.
Watch the video for Sections 4.1 4.2: CR300 QuickStart Part 2.
Click Next.
3
CR300-Series Datalogger
Click Next.
Click Next.
After the driver has been installed, connect the CR300 USB port to the PC with the included USB cable (pn
27555). The connection supplies 5 V power over USB as well as a communication link.
NOTE The Power LED indicates the program and power state of the CR300. Because the
CR300 ships with a program set to run on power-up, the Power LED will quickly flash
3 times every 10 seconds when powered over USB. See TABLE 6-4, Power LED
Activity (p. 41), for other flash patterns.
Select the COM Port labeled CR300. Keep all other defaults.
Click Next.
4
CR300-Series Datalogger
Click Next.
Click Next.
Click Next.
5
CR300-Series Datalogger
Click Next.
If the current program is not QuickStart.CR300, visit www.campbellsci.com/start/cr300, where the program can be
downloaded.
Click Select and Send Program. Select the downloaded program QuickStart.CR300, and click Open. A status bar
will appear while the program is sent to the CR300, followed by a confirmation that the transfer was successful.
Click OK to close the confirmation.
Click Next.
6
CR300-Series Datalogger
LoggerNet only:
The Data Files window shows the
data tables available on the CR300
and allows you to select which data
tables to collect. To include a table
in data collection (Section 4.6,
Collect Data (p. 16)), highlight the
table name in the Tables list and
check the Table Collected During
Data Collection box. Select a Data
File Option suitable for your
application. Make note of the
Output File Name. Change this
name by clicking .
Click Next.
LoggerNet only:
Optional: In the Scheduled
Collection window, check
Scheduled Collection Enabled to
have LoggerNet collect data from
the datalogger according to a
schedule. Set the Base Date and
Time at which you would like to
begin scheduled collections. Enter
the Collection Interval.
We are not going to do scheduled collections in this tutorial. Click Schedule Help to learn more about this option
or refer to the Collect Data Tutorial.
Click Next.
7
CR300-Series Datalogger
Click Connect.
8
CR300-Series Datalogger
Press Connect.
View the Public table by selecting the Public table in the Table Monitor list.
9
CR300-Series Datalogger
LoggerNet:
From the LoggerNet toolbar, click
Program | Short Cut.
Enter 1 in the Scan Interval box and select Seconds in the Scan Interval list.
Click Next.
NOTE The first time Short Cut is run, a prompt will appear asking for a choice of first notch
frequency. Select 60 Hz Noise Rejection for North America and areas using 60 Hz AC
voltage. Select 50 Hz Noise Rejection for most of the Eastern Hemisphere and areas
that operate at 50 Hz.
A second prompt lists sensor support options. Campbell Scientific, Inc. (US) is
probably the best fit if you are outside Europe.
To change the first notch frequency or sensor support option for future programs, use
the Program menu.
10
CR300-Series Datalogger
Click OK in the dialog window to accept default options that include selection of 1 sensor named Temp_C, and
PTemp_C as the reference temperature measurement.
NOTE PTemp_C is the temperature measurement of the processing board and therefore
DOES NOT PROVIDE an accurate reference temperature for the thermocouple. To
make an accurate thermocouple measurement with the CR300, an EXTERNAL
REFERENCE TEMPERATURE must be used.
NOTE BattV (battery voltage) and PTemp_C (processing board temperature) are default
measurements. During operation, battery and temperature should be recorded at least
daily to assist in monitoring system status.
11
CR300-Series Datalogger
Disconnect the USB cable. Attach the thermocouple to the CR300 as shown in Wiring Diagram.
Click Next.
12
CR300-Series Datalogger
Only one table is needed for this tutorial, so Table 2 can be removed. Click the Table2 tab, then click Delete Table.
Change the Table Name of the remaining table from Table1 to OneMin. Change the Store Every interval to 1
Minutes.
Select BattV under Selected Sensors and then click Average. Repeat this procedure for PTemp_C and Temp_C.
13
CR300-Series Datalogger
Give the program the name MyTemperature. Save it in the default C:\Campbellsci\SCWin folder. Do not send the
program at this time.
Click No. Do not send the program here. You will do this in Section 4.5, Send a Program (p. 15).
If the program was created directly in the CRBasic Editor, attach sensors and
devices according to the options chosen for the measurement instructions and
according to their individual product manuals.
14
CR300-Series Datalogger
Send the program created in Section 4.3, Create a Program (p. 10). Browse to the C:\Campbellsci\SCWin folder.
Select MyTemperature.CR300 file. Click Open.
Click Yes to confirm that data deletion is OK and to send the program to the CR300.
After sending a program, it is a good idea to monitor the data to make sure it is measuring as you expect. Follow
the steps outlined in Section 5.6, Monitoring Data (p. 23).
15
CR300-Series Datalogger
Click Connect.
16
CR300-Series Datalogger
17
CR300-Series Datalogger
Click File | Open to open a file for viewing. In the dialog box, select the data file to view. A data file has a .dat
extension. Click Open.
View data in the OneMin table by opening the CR300Series_OneMin.dat file in the C:\Campbellsci\LoggerNet
folder.
18
CR300-Series Datalogger
1. Insert the three included nylon anchors into the backplate. Position them to
align with the three mounting holes on the base of the CR300.
2. Holding the CR300 to the backplate, screw the three included screws into
the nylon anchors.
19
CR300-Series Datalogger
5. Overview
5.1 Wiring Panel Overview
Earth Earth
Ground Ground
Ether-
Analog Input Function C1 C2 P_SW P_LL VX1 VX2 SE1 SE2 SE3 SE4 SE5 SE6 RS-232 SW12 Max
net
Single-Ended Voltage 6
Differential Voltage H L H L H L 3
4 to 20 or 0 to 20 mA 2
Ether-
Analog Output Function C1 C2 P_SW P_LL VX1 VX2 SE1 SE2 SE3 SE4 SE5 SE6 RS-232 SW12 Max
net
Switched-Voltage Excitation 2
5 V Source 4
12 V Source 1
Ether-
Digital I/O Function C1 C2 P_SW P_LL VX1 VX2 SE1 SE2 SE3 SE4 SE5 SE6 RS-232 SW12 Max
net
RS-232 1
RS-232 0-5 V Tx Rx 1
SDI-12 2
Pulse-Width Modulation 4
Timer Input 4
Period Average 4
Interrupt 6
General I/O 7
High Frequency 8
Low Level AC 1
20
CR300-Series Datalogger
Device Configuration Utility Help guides you through connection and use. The
simplest connection is a USB cable from the computer USB port to the USB
port on the CR300.
Network Planner calculates the optimum settings for each device in the
network and then allows you to send these settings to the device. If any change
is made to a device in the network, that change is propagated to every affected
device setting. Network Planner can then use the information entered to
configure LoggerNet Setup.
21
CR300-Series Datalogger
For many complex applications, Short Cut is still a good place to start. When
as much information as possible is entered, Short Cut will create a program
template from which to work, already formatted with most of the proper
structure, measurement routines, and variables. The program can then be edited
further using CRBasic Program Editor. Appendix D, Importing Short Cut
Code Into CRBasic Editor (p. D-1), discusses this procedure.
NOTE Once a Short Cut generated program has been edited with
CRBasic Editor, it can no longer be modified with Short Cut.
22
CR300-Series Datalogger
A good practice is to always retrieve data from the CR300 before sending a
program; otherwise, data may be lost. Some methods of sending a program
give the option to retain data when possible. Regardless of the program upload
tool used, data will be erased when a new program is sent if any change occurs
to one or more data table structure in the following list:
Data table name(s)
Data output interval or offset
Number of fields per record
Number of bytes per field
Field type, size, name, or position
Number of records in table
Step-by-step instructions for monitoring data are given in Section 4.2, Connect
to the CR300 (p. 8).
Data tables are created within the datalogger program using the DataTable()
instruction (see Appendix E.5, Data Tables (p. E-8)). In Short Cut, data tables are
23
CR300-Series Datalogger
created in the Outputs step. The CR300 can host up to 20 data tables. Each
data table will update at its own data table interval or according to a trigger set
within the program.
The data file consists of five or more rows. Each row consists of columns, or
fields. The first four rows constitute the file header. Subsequent rows contain
data records.
The first header row of the data table is the environment line. It consists of
eight fields, listed in TABLE 5-3.
The second header row reports fieldnames. This row consists of fieldnames
that identify the name of individual fields as given in the datalogger program.
Default fieldnames are a combination of the variable names (or aliases) from
which data are derived and a three-letter suffix. The suffix is an abbreviation of
the data process that outputs the data to storage. See TABLE 5-4 for a list of
these abbreviations.
24
CR300-Series Datalogger
The third header row identifies engineering units for that field of data. These
units are declared at the beginning of a CRBasic program, as shown in
CRBasic Example E-6, Definition and Use of a Data Table (p. E-8). In Short Cut,
units are chosen when sensors or measurements are added. Units are strictly for
documentation. The CR300 does not make use of declared units, nor does it
check their accuracy.
The fourth header row reports abbreviations of the data process used to
produce the field of data. See TABLE 5-4.
25
CR300-Series Datalogger
Subsequent rows are called data records. They include observed data and
associated record keeping. The first field is a timestamp (TS), and the second
field is the record number (RN).
The timestamp shown represents the time at which the data is written.
Therefore, because the scan rate of the program MyTemperature.CR300 is 1
second, Temp_C_Avg in record number 3 in TABLE 5-2, Typical Data Table
(p. 24), shows the average of the measurements taken over the minute beginning
at 14:26:01 and ending at 14:27:00. As another example, consider rainfall
measured every second with a daily total rainfall recorded in a data table
written at midnight. The record timestamped 2016-03-08 00:00:00 will contain
the total rainfall beginning at 2016-03-07 00:00:01 and ending at 2016-03-08
00:00:00.
6. Details
6.1 Analog Measurements
Analog sensors output a continuous voltage or current signal that varies with
the phenomena measured.
1. Set amplifier gain for the voltage range selected with the CRBasic
measurement instruction parameter Range. Set the A-to-D converter for
the first notch frequency selected with fN1.
2. If used, turn on excitation to the level selected with ExmV.
3. Multiplex selected terminals (SEChan or DiffChan).
4. Delay for the entered settling time (SettlingTime).
5. Perform the A-to-D conversion.
6. Repeat for input reversal as determined by parameter RevDiff.
7. Apply multiplier (Mult) and offset (Offset) to measured result.
26
CR300-Series Datalogger
BrHalf3W
TCSE()
Therm107()
Therm108()
Therm109()
27
CR300-Series Datalogger
BrHalf() half-bridge
BrHalf3W() three-wire half-bridge
BrHalf4W() four-wire half-bridge
BrFull() four-wire full-bridge
BrFull6W() six-wire full-bridge
Fundamental Relationship2:
1
= =
+
28
CR300-Series Datalogger
Fundamental Relationship2:
22 1
= =
1
Four-Wire Half-Bridge1,3
Fundamental Relationship2:
2
= =
1
Full-Bridge1,3
Fundamental Relationship2:
1 3 2
= 1000 = 1000
3 + 4 1 + 2
29
CR300-Series Datalogger
Fundamental Relationship2:
2 3 2
= 1000 = 1000
1 3 + 4 1 + 2
1
Key: Vx = excitation voltage; V1, V2 = sensor return voltages; Rf = fixed, bridge, or completion resistor; Rs =
variable or sensing resistor.
2
Where X = result of the CRBasic bridge measurement instruction with a multiplier of 1 and an offset of 0.
3
Campbell Scientific offers resistive-bridge terminal input modules to facilitate this measurement.
NOTE The CR300 is not capable of applying reverse excitation. Set the
RevEx parameter of all bridge measurement instructions to False.
30
CR300-Series Datalogger
To select the appropriate voltage range, the expected current output range must
be known. Using Ohms Law, multiply the maximum expected current by 100
to find the maximum voltage to be measured. Because the maximum voltage
input is 2500 mV, the maximum current input must be 25 mA or less.
31
CR300-Series Datalogger
32
CR300-Series Datalogger
Pulse input terminals and the input types they can measure are shown in
TABLE 6-3.
33
CR300-Series Datalogger
Pulse-width modulation can be done on terminals SE1 SE4. See the PWM()
instruction in CRBasic Editor Help for more information.
6.5 Communication
6.5.1 Communication Ports
The CR300 is equipped with hardware ports that allow communication with
other devices and networks, such as:
PC
Smart sensors
SDI-12
Modbus
DNP3
Campbell Scientific PakBus networks
6.5.1.1 USB Port
One micro-B USB port, labeled USB, for communicating with a PC through
datalogger support software. Powering through the USB port has the limitations
discussed in Section 6.9.1.1, Power Sources (p. 40).
34
CR300-Series Datalogger
These two ports can be used with smart sensors that deliver measurement data
through serial data protocols or with devices such as modems that
communicate using serial data protocols.
Com1 is not capable of TTL logic levels and so is not compatible with
TTL-to-RS-232 converters for the purpose of presenting a true RS-232
interface.
Com1 also has a low input resistance that may make it incompatible with
some serial devices with the addition of in-line resistance.
35
CR300-Series Datalogger
Modbus has a set command structure. It uses a common bus and addresses each
node.
See CRBasic Editor Help for the most recent information on each of these
instructions and for program examples. Also, see the application note Using
Campbell Scientific Dataloggers as Modbus Slave Devices in a SCADA
Network, available at www.campbellsci.com, for detailed information and
program examples.
36
CR300-Series Datalogger
37
CR300-Series Datalogger
6.6 Memory
Final storage memory for the CR300 is organized in 4 KB sectors of serial
flash. Each sector is rated for 100,000 serial flash erases. TABLE 7-8, Memory
Size and Allocation (p. 49), provides a description of each memory location and
the types of data each stores.
Data concerning CR300 memory are posted in the Status and DataTableInfo
tables.
When a data table is set up, an initial memory sector is erased to prepare for
new data. Erasing a sector can take up to 100 ms. Each data table undergoes
this initialization process. As data are written to memory and a sector fills, the
next assigned sector is erased in preparation for new data to be written to it.
When running fast programs or writing to multiple data tables, this normal
function of erasing memory sectors can result in skipped scans.
By default, data storage memory sectors are organized as ring memory. When
the ring is full, oldest data are overwritten by newest data. Using the FillStop
statement sets a program to stop writing to the data table when it is full, and no
more data are stored until the table is reset. To see the total number of records
that can be stored before the oldest data are overwritten, or to reset tables, go to
Station Status | Table Fill Times in your datalogger support software.
6.8 Grounding
Proper grounding lends stability and protection to a data acquisition system. It
is the easiest and least expensive insurance against data loss and often the
38
CR300-Series Datalogger
most neglected. The following terminals are provided for connection of sensor
and CR300 grounds:
Signal Ground () reference for single-ended analog inputs,
excitation returns, and as a ground for sensor shield wires.
Power Ground (G) return for 5V, 12V, and digital sensors. Use of
G grounds for these outputs minimizes potentially large current flow
through the analog-voltage-measurement section of the wiring panel,
which can cause single-ended voltage measurement errors.
Earth Ground Lug () connection point for heavy-gauge earth-
ground wire. A good earth connection is necessary to secure the
ground potential of the CR300 and shunt transients away from
electronics. 14 AWG wire, minimum, is recommended.
The most common and destructive electrostatic discharges are primary and
secondary lightning strikes. Primary lightning strikes hit instrumentation
directly. Secondary strikes induce voltage in power lines or wires connected to
instrumentation. While elaborate, expensive, and nearly infallible lightning
protection systems are on the market, Campbell Scientific, for many years, has
employed a simple and inexpensive design that protects most systems in most
circumstances. The system employs a lightning rod, metal mast, heavy-gauge
ground wire, and ground rod to direct damaging current away from the CR300.
This system, however, not infallible. FIGURE 6-3 is a drawing of a typical
application of the system.
39
CR300-Series Datalogger
Charge Dissipation
Path of Least
Lightning
Resistance
Lightning Rod
Highly Conductive
Metal Mast
Instrument
Enclosure
12 AWG
Copper Wire
4 AWG
Copper Cable
Copper-Sheathed
Ground Rod Strike Dissipation
6.9 Power
6.9.1 Power In
6.9.1.1 Power Sources
The CR300 is designed to receive power from a variety of sources. Following
is a list of CR300 power input terminals and the respective power types
supported.
BAT terminals voltage input is 10 to 16 Vdc. This connection uses the least
current since the internal CR300 charging circuit is bypassed. The voltage at
BAT is the same voltage, less 0.3 V, as that available on the SW12V terminal.
If the voltage on the BAT terminals exceeds 19 V, power is shut off to the
CR300 to prevent damaging circuitry.
40
CR300-Series Datalogger
through the CHG terminals. The onboard charging regulator is designed for
efficiently charging lead-acid batteries. It will not charge lithium or alkaline
batteries.
USB port 5 Vdc via USB connection. If power is also provided with BAT
or CHG, power will be supplied by whichever has the highest voltage. If USB
is the only power source, then SW12V will not be operational. Functions that
will be active with a 5 Vdc source include sending programs, adjusting
datalogger settings, and making some measurements. The excitation range of
VX1 and VX2 is reduced to 150 to 2500 mV. Control ports output 4.75 V, 8
mA maximum.
Refer to the application note Power Supplies and the video Power Budgeting,
available at www.campbellsci.com, for more help in selecting a power supply.
41
CR300-Series Datalogger
7. Specifications
7.1 Voltage Measurements
Voltage measurements use a 24-bit A-to-D converter. One channel at a time is
measured in numeric succession.
Terminals
Differential Configuration: DIFF 1H/1L 3H/3L
Single-Ended Configuration: SE 1 - 6
Accuracy1,2
0 to 40 C: (0.04% of reading + Offset3)
40 to 70 C: (0.1% of reading + Offset3)
42
CR300-Series Datalogger
RMS noise, where RMS noise is the standard deviation of many measurements of
grounded inputs.
Differential Differential
with Input without Input
Range Reversal Reversal Single-Ended
(mV) (V) (V) (V)
100 to +2500 20 40 60
34 to +34 6 14 20
43
CR300-Series Datalogger
Multiplexed3 Measurement
With Input Without Input
Reversal Reversal
fN1 Time Rate Time Rate
(Hz) (ms) (Hz) (ms) (Hz)
4000 2.9 345 1.4 714
400 14.6 68.5 7.3 137
50/60 103 9.71 51.5 19.4
1Default settling time of 500 s
2Totalanalog voltage measurement speed = multiplexed
measurement time number of repetitions + 0.8 ms
3Refers to multiplexing circuitry internal to the CR300.
Ratiometric Accuracy1,2,3
44
CR300-Series Datalogger
Terminals: VX1-VX2
Resolution: 4.5 mV
Maximum Source
or Sink Current: 50 mA total, concurrently or independently
Range: 0 to 25 mA
Accuracy
0 to 40 C: 0.14% of reading
40 to 70 C: 0.26% of reading
45
CR300-Series Datalogger
Input Hysteresis: 12 mV at 1 Hz
46
CR300-Series Datalogger
Maximum
Terminal High State Low State Drive Current Input Voltage
C1 5.0 V output
0V 10 mA at 3.5 V 10 V, +15 V
C2 3.3 V input
SE1
3.3 V 0V 100 A at 3.0 V 6 V, +9 V
SE2
SE3
SE4 3.3 V 0V 100 A at 3.0 V 17 V
P_SW
47
CR300-Series Datalogger
Resolution
0 5 ms: 83.33 ns or 12 MHz
5 325 ms: 5.00 s or 200 kHz
> 325 ms: 31.25 s or 32 kHz
Voltage Levels: See TABLE 7-6, Digital I/O Voltage Levels (p. 47)
Drive Current: See TABLE 7-6, Digital I/O Voltage Levels (p. 47)
7.10 Communication
Internet Protocols: PPP, ICMP/Ping, Auto-IP (APIPA), IPv4,
IPv6, UDP, TCP, TLS, DHCP Client, SLAAC,
DNS Client, Telnet
Additional
Protocols Supported: PakBus, PakBus Encryption, SDI-12, Modbus
RTU/ASCII/TCP, DNP3/TCP, NTCIP, NMEA
0183. Custom user-definable over serial, TCP,
and UDP.
7.11 System
Operating Temperature: 40 to 70 C
Clock Resolution: 1 ms
48
CR300-Series Datalogger
30 MB
Data Storage (10 Serial Flash Data, DNP3 Events
MB1)
Operating System 2 MB Flash Operating System
Settings, Calibration, TLS
2 MB
Settings Serial Flash Certificates and Key, System
(1 MB1)
Information
Background Tasks, Buffers,
System Memory, Program
RAM 756 KB RAM
Memory, Table Memory,
Program Variables
1Applies to serial numbers lower than 2813.
49
CR300-Series Datalogger
7.13 Compliance
View EU Declarations of Conformity at www.campbellsci.com/cr300 and
www.campbellsci.com/cr310.
Protection: IP30
7.14 Physical
Dimensions
CR300: 14.0 x 7.6 x 5.1 cm (5.5 x 3.0 x 2.0 in)
CR310: 16.2 x 7.6 x 5.7 cm (6.4 x 3.0 x 2.3 in)
additional clearance required for cables and
leads
Weight/Mass
50
CR300-Series Datalogger
Maximum Possible
Over-the-Air Data Rates
802.11b: up to 11 Mbps
802.11g: up to 54 Mbps
802.11n: up to 72 Mbps
Rx Sensitivity: 97 dBm
51
CR300-Series Datalogger
8. Maintenance
Protect the CR300 from humidity and moisture. When humidity levels reach
the dewpoint, condensation occurs, and damage to CR300 electronics can
result. Effective humidity control is the responsibility of the user. Adequate
desiccant should be placed in the instrumentation enclosure to provide
protection.
8.1 Calibration
Maintain a level of calibration appropriate to the application. Campbell
Scientific recommends factory recalibration of the CR300 every three years.
Consider the following factors when setting a calibration schedule:
52
CR300-Series Datalogger
way, use the Send New button in the datalogger support software, as shown in
Section 4.5, Send a Program (p. 15).
9. Troubleshooting
9.1 Station Status
The Summary tab of the Station Status window describes the condition of the
datalogger. Here you can see the operating system version of the datalogger,
the name of the current program, program compile results, and other key
indicators. Items that may need your attention appear in red. TABLE 9-1
describes the significance of some entries in the window. In FIGURE 9-1, the
battery voltage is in red, indicating that there may be a problem; however, 0.00
is reported as the battery voltage when powered over USB. Hence, there is no
issue in this example.
53
CR300-Series Datalogger
54
CR300-Series Datalogger
Watchdog Errors Watchdog errors indicate that the CR300 has crashed and reset itself.
This could be due to
transient voltage
a mis-wired or malfunctioning sensor
a poor ground connection on the power supply
running the CRBasic program very fast
many PortSet() instructions back-to-back with no delay
high-speed serial data on multiple ports with very large data
packets or bursts of data
If any of these are not the apparent cause, contact Campbell Scientific
for assistance. Causes that require assistance include the following:
Memory corruption
Operating System problem
Hardware problem
Results for Last Program Compiled Messages generated by the CR300 at program upload and as the
program runs are reported here. Warnings indicate that an expected
feature may not work, but the program will still operate. Errors
indicate that the program cannot run.
Skipped Scans Skipped scans are caused when a program takes longer to process than
the scan rate allows. An occasional skipped scan can be caused by
memory formatting as discussed in Section 6.6, Memory (p. 38). If any
scan skips repeatedly, the datalogger program may need to be
optimized or reduced.
Skipped Records Skipped records usually occur because a scan is skipped. They indicate
that a record was not stored to the data table when it should have been.
Variable Out of Bounds Variable-out-of-bounds errors happen when an array is not sized to the
demands of the program. The CR300 attempts to catch all out-of-
bounds errors at compile time and document the error. However, it is
not always possible, so these errors may occur during runtime.
Battery Voltage If powering through USB, reported battery voltage should be 0 V. If
connecting to an external power source, battery voltage should be
reported at or near 12 V.
1. With a voltmeter, check the voltage of the primary power source at the
CHG and BAT terminals on the face of the CR300. If powering through
USB, it should be in the 2 Vdc range. If connecting to a power source via
the BAT terminal, it should be 10 to 16 Vdc. If connecting to a power
source via the CHG terminals, voltage measured should be 16 to 32 Vdc.
55
CR300-Series Datalogger
3. Check the CRBasic program. If the program was written solely with Short
Cut, the program is probably not the source of the problem. If the program
was written or edited with CRBasic Editor, logic and syntax errors could
easily have crept into the code. To troubleshoot, create a stripped-down
version of the program, or break it up into multiple smaller units to test
individually. For example, if a sensor signal-to-data conversion is faulty,
create a program that only measures that sensor and stores the data, absent
from all other inputs and data. Write these mini-programs before going to
the field, if possible.
Input signals exceed the voltage range chosen for the measurement.
An invalid SDI-12 command is sent
An SDI-12 sensor does not respond or aborts without sending data
Undefined arithmetic expressions, such as 0 0.
If a NAN is included in the values being processed, NAN will be stored. Note
that since there is no such thing as NAN for integers, values that are converted
from float to integer will be expressed in data tables as the most negative
number for a given data type. For example, the most negative number of data
56
CR300-Series Datalogger
type FP2 is 7999, so NAN for FP2 data will appear in a data table as 7999.
If the data type is Long, NAN will appear in the data table as 2,147,483,648.
To reset the processor, simply power cycle the CR300. This resets its short-
term memory, restarts the current program, sets variables to their starting
values, and clears communication buffers. This does not clear data tables but
may result in a skipped record. If the datalogger is remote, a power cycle can
be mimicked in Terminal Emulator or in a CRBasic program shown below:
57
CR300-Series Datalogger
'Main Program
BeginProg
Scan (1,Sec,0,0)
PanelTemp (PTemp,60)
Battery (Batt_volt)
If RestartProg Then
RestartProg = False
Restart
EndIf
NextScan
EndProg
10. Glossary
A-to-D
Com1
CRBasic Editor
A utility included with datalogger support software. Use it to create and edit
CRBasic datalogger programs. Update the CRBasic compiler by downloading
the appropriate datalogger operating systems at
www.campbellsci.com/downloads and running the downloaded executable file.
58
CR300-Series Datalogger
File Control
The CR300 operating system is a set of instructions that controls the basic
functions of the device. The operating system is preloaded into the CR300 at
the factory but can be reloaded or upgraded by using Device Configuration
Utility software or datalogger support software. Follow the procedures outlined
in Section 8.2, Sending an Operating System (p. 52).
59
CR300-Series Datalogger
60
Appendix A. CR310 Ethernet
Communication QuickStart
A.1 Configure the CR310
Watch the video for this section: Datalogger Ethernet Configuration.
A-1
Appendix A. CR310 Ethernet Communication QuickStart
A-2
Appendix A. CR310 Ethernet Communication QuickStart
LoggerNet:
Click Next.
Click Next.
A-3
Appendix A. CR310 Ethernet Communication QuickStart
Click Next.
1 The datalogger port number can be
changed in Device Configuration Utility
in the Network Services subtab.
Click Next.
Click Next.
A-4
Appendix A. CR310 Ethernet Communication QuickStart
Click Next.
Click through the remaining steps and adjust settings where needed for your setup.
A-5
Appendix A. CR310 Ethernet Communication QuickStart
A-6
Appendix B. RF407, RF412, and RF422
Communication QuickStart
B.1 Introduction
This appendix can be used to quickly set up radio communications with a
CR300-series datalogger. Throughout these steps, the CR300-RF407 represents
both CR300 and CR310 datalogger models and each of the RF407, RF412, and
RF422 radio options, unless otherwise noted. Similarly, the RF407 standalone,
or independent, radio represents each of the RF407, RF412, and RF422
models, unless otherwise noted.
NOTE These procedures assume the RF407 and the CR300-RF407 are at
their factory default settings.
B-1
Appendix B. RF407, RF412, and RF422 Communication QuickStart
NOTE This equipment has been tested and found to comply with the
limits for a Class A digital device, pursuant to part 15 of the FCC
Rules. These limits are designed to provide reasonable protection
against harmful interference when the equipment is operated in a
commercial environment. This equipment generates, uses, and can
radiate radio frequency energy and, if not installed and used in
accordance with the instruction manual, may cause harmful
interference to radio communications. Operation of this
equipment in a residential area is likely to cause harmful
interference in which case the user will be required to correct the
interference at his or her own expense.
B-2
Appendix B. RF407, RF412, and RF422 Communication QuickStart
Click Ok.
Click Connect.
Click Apply.
Click Yes.
B-3
Appendix B. RF407, RF412, and RF422 Communication QuickStart
Click OK.
B-4
Appendix B. RF407, RF412, and RF422 Communication QuickStart
B-5
Appendix B. RF407, RF412, and RF422 Communication QuickStart
LoggerNet:
Click Next.
Click Next.
Click Next.
B-6
Appendix B. RF407, RF412, and RF422 Communication QuickStart
Click Next.
Click Next.
Click Next.
B-7
Appendix B. RF407, RF412, and RF422 Communication QuickStart
Optional: Click through the remaining steps and adjust settings where needed for your setup.
B-8
Appendix B. RF407, RF412, and RF422 Communication QuickStart
NOTE Most Campbell Scientific devices come from the factory with a
default PakBus address of 1. For this reason, it is best not to assign
PakBus address 1 to any device in the network. Then, if a new
device with default settings is added to the system, it will not
create a conflict.
Click Apply.
B-9
Appendix B. RF407, RF412, and RF422 Communication QuickStart
B-10
Appendix B. RF407, RF412, and RF422 Communication QuickStart
Click Apply.
B-11
Appendix B. RF407, RF412, and RF422 Communication QuickStart
Select ComPort.
Select CR300Series.
Click Close.
B-12
Appendix B. RF407, RF412, and RF422 Communication QuickStart
B-13
Appendix B. RF407, RF412, and RF422 Communication QuickStart
Click Rename.
B-14
Appendix B. RF407, RF412, and RF422 Communication QuickStart
Click Rename.
B-15
Appendix B. RF407, RF412, and RF422 Communication QuickStart
Network Planner calculates the optimum settings for each device in the
network and allows you to send these settings to the device. If any change is
made to a device in the network, that change is propagated to every affected
device setting. Network Planner can then use the information entered to
configure LoggerNet Setup.
B.7 Troubleshooting
If there are intermittent communication problems with the above setups, there
may be another network in the area causing interference. To help remove the
interference, use Device Configuration Utility to change the Network ID and
RF Hop Sequence in all RF407s and CR300-RF407s to a different value. Each
of these settings must have the same value in all RF407s and CR300-RF407s
within a network. For example, the Network ID in all devices could be set to
1726, and the RF Hop Sequence in all devices could be set to 1. The Network
B-16
Appendix B. RF407, RF412, and RF422 Communication QuickStart
ID can be any number between 0 and 32767. The RF Hop Sequence can be
any number between 0 and 7 in an RF407 or RF412 network; it can be any
number between 0 and 9 in an RF422 network.
B-17
Appendix B. RF407, RF412, and RF422 Communication QuickStart
B-18
Appendix C. WIFI Communication
QuickStart
C.1 Introduction
This appendix can be used to quickly set up Wi-Fi communications with a
CR300-series datalogger. The first example shows how to communicate to a
computer by creating a Wi-Fi network with the datalogger. The second
example shows how to communicate to a computer by connecting to an
existing Wi-Fi network.
Throughout these steps, the CR300-WIFI represents both CR300- and CR310-
WIFI datalogger models, unless otherwise noted.
The LoggerLink mobile app for iOS and Android can also be used to connect
with a CR300-WIFI. The setup follows the same steps shown in this video:
CR6-WIFI Datalogger | Setting up a Network.
C-1
Appendix C. WIFI Communication QuickStart
C-2
Appendix C. WIFI Communication QuickStart
Click Connect.
LoggerNet:
C-3
Appendix C. WIFI Communication QuickStart
Click Next.
Click Next.
Click Next.
Click Next.
C-4
Appendix C. WIFI Communication QuickStart
Click Next.
Click Next.
Click through the remaining steps and adjust settings where needed for your setup.
C-5
Appendix C. WIFI Communication QuickStart
C-6
Appendix C. WIFI Communication QuickStart
Click Apply.
C-7
Appendix C. WIFI Communication QuickStart
Click Connect.
C-8
Appendix C. WIFI Communication QuickStart
C-9
Appendix C. WIFI Communication QuickStart
C-10
Appendix C. WIFI Communication QuickStart
C-11
Appendix C. WIFI Communication QuickStart
C-12
Appendix D. Importing Short Cut Code
Into CRBasic Editor
This tutorial shows the following:
How to import a Short Cut program into a program editor for
additional refinement
How to import a wiring diagram from Short Cut into the comments of
a custom program
Short Cut creates files, which can be imported into CRBasic Editor. Assuming
defaults were used when Short Cut was installed, these files reside in the
C:\Campbellsci\SCWin folder:
.DEF (wiring and memory usage information)
.CR300 (CR300 datalogger code)
Use the following procedure to import Short Cut code and wiring diagram into
CRBasic Editor:
3. Click File | Open. Assuming the default paths were used when Short Cut
was installed, navigate to C:\Campbellsci\SCWin folder. The file of
interest has the .CR300 extension. Select the file and click Open.
NOTE Once the file is edited with CRBasic Editor, Short Cut can no
longer be used to edit the datalogger program. Change the name
of the program file or move it, or Short Cut may overwrite it next
time it is used.
5. The program can now be edited, saved, and sent to the datalogger.
D-1
Appendix E. Introduction to CRBasic
Programming
Essential elements of a CRBasic program are listed in TABLE E-1, and
demonstrated in CRBasic Example E-1.
E-1
Appendix E. Introduction to CRBasic Programming
'Declarations
'Define Constants
Const RevDiff = 1
Const Del = 0 'default
Declare constants
Const Integ = 400
Const Mult = 1
Const Offset = 0
'Begin Program
BeginProg
'Measurements
Measure
PanelTemp(RefTemp,400)
TCDiff(TC()...Offset)
'Controls
PortSet(...)
'End Program
EndProg
E.1 Comments
Comments are nonexecutable text in the body of a program. Comments
document or clarify the program. As shown in CRBasic Example E-2, insert
comments into a program by preceding the comment with a single quote (').
Comments can be entered either as independent lines or following CR300
E-2
Appendix E. Introduction to CRBasic Programming
code. When the CR300 compiler sees a single quote ('), it ignores the rest of
the line.
'This program example demonstrates the insertion of comments into a program. Comments are
'placed in two places: to occupy single lines, such as this explanation does, or to be
'placed after a statement.
BeginProg
EndProg
E.2 Variables
A variable is a packet of memory that is given an alphanumeric name.
Measurements and processing results pass through variables during program
execution. Variables are declared as Public or Dim. Public variables are
viewable through datalogger support software. Dim variables cannot be
viewed. Declared variables are initialized once when the program starts.
Names must start with a letter, underscore, or dollar sign. Spaces and quotation
marks are not allowed. Variable names are not case sensitive.
NOTE Keywords and predefined constants are reserved for CR300 use
and will cause a runtime or compile error if used otherwise.
CRBasic Editor Help provides a list of keywords and predefined
constants.
At the time the datalogger program compiles, variables are set equal to zero,
Booleans are set to false, and strings are set equal to an empty, null-terminated,
byte array. Variables can also be assigned initial values in the declaration.
Following are examples of declaring and initializing variables:
E-3
Appendix E. Introduction to CRBasic Programming
Word Size
Name Command Description Notes Range Resolution
(Bytes)
Single-
As Float precision Data type of all variables unless
declared otherwise. 1.4E45 to 3.4E38 24 bits
Float or floating 4
Consecutive Integer: 224 (about 7 digits)
As IEEE4 point IEEE 754
number
IEEE 754
Use to minimize floating point
Double- errors when doing floating point
As precision calculations or to store 4.94065E-324 to
53 bits
Double Double or floating 8 measurements of high-resolution 1.79769E308
(about 14 digits)
As IEEE8 point digital sensors. Consecutive Integer: 253
number
Suitable for storing integers
larger than Longs.
Use to store integer data.
Speed: integer math is faster
than floating point math.
Resolution: 32 bits.
32-bit signed Suitable for storing whole 2,147,483,648 to
Long As Long 4 1 bit
integer numbers, counting numbers, and +2,147,483,647
integers in final-data memory. If
storing non-integers, the
fractional portion of the value is
lost.
A Boolean will never hold any
value other than True or False
(1 or 0). Any non-zero numeric
value or non-empty string
Boolean
As written to a Boolean will be True = 1 True (1) or
Boolean True/False 4
Boolean stored as True (1). Zero or an False = 0 False (0)
1/0
empty (nulled) string written to a
Boolean will be stored as False
(0). See Appendix E.9,
Expressions (p. E-15).
E-4
Appendix E. Introduction to CRBasic Programming
Word Size
Name Command Description Notes Range Resolution
(Bytes)
See caution.1
Default word String size is defined by the
size is 4 bytes. CR300 operating system and the
Minimum: 3 + CRBasic program.
null terminator When converting from String to Unless declared otherwise, string size is 24
Float, numerics at the beginning bytes or characters. String size is allocated in
Null- Default: 23 + multiples of four bytes; for example, String *
null terminator of a string convert, but
terminated conversion stops when a non- 25, String * 26, String * 27, and String * 28
String As String Maximum =
array of numeric is encountered. If the allocate 28 bytes (27 usable). Minimum string
characters limited by size string begins with a non- size is 4 (3 usable). See CRBasic Editor Help
of available numeric, the Float will be NAN. for more information. Maximum length is
CR300 RAM, If the string contains multiple limited only by available CR300 memory.
up to 200 KB numeric values, the SplitStr()
for DIM instruction can be used to parse
variable. out the numeric values. Refer to
CRBasic Editor Help.
1
CAUTION: When using a very long string in a variable declared Public, the operations of datalogger support software will frequently
transmit the entire string over the communication link. If communication bandwidth is limited, or if communications are paid for by the
byte, declaring the variable Dim may be preferred.
'This program example demonstrates various data type declarations. If not otherwise specified,
'data types default to floating point: As Float in Public or Dim declarations.
BeginProg
'Program logic goes here
EndProg
E-5
Appendix E. Introduction to CRBasic Programming
Public TempC1
Public TempC2
Public TempC3
Public TempC4
Public TempC(4).
A string array called StringVar, with five elements in the array and each
element with a length of 36 characters, is declared as
'This program example demonstrates the use of a variable array to reduce code. In this
'example, two variable arrays are used to convert four temperature measurements from
'degrees C to degrees F.
Public TempC(4)
Public TempF(4)
Dim T
BeginProg
Scan(1,Sec,0,0)
Therm107(TempC(1),1,1,Vx1,0,400,1.0,0)
Therm107(TempC(2),1,2,Vx1,0,400,1.0,0)
Therm107(TempC(3),1,3,Vx2,0,400,1.0,0)
Therm107(TempC(4),1,4,Vx2,0,400,1.0,0)
For T = 1 To 4
TempF(T) = TempC(T) * 1.8 + 32
Next T
NextScan
EndProg
E-6
Appendix E. Introduction to CRBasic Programming
E.3 Constants
Constants are discrete packets of CR300 memory that store specific values that
do not vary during program execution. A constant can be declared at the
beginning of a program to assign an alphanumeric name to a value. The
program can then refer to the name rather than the value itself. Using a constant
in place of a value can make the program easier to read and modify, and more
secure against unintended changes. Following is an example of declaring a
constant:
User Settings include two arrays: UserStr() and UserVal(). Each array has 12
fields. UserStr() holds only strings, and UserVal() holds only floating point
values. Each can be entered manually in Device Configuration Utility in the
Settings Editor | User Settings tab, or they can be written through a CRBasic
program using the SetSetting() instruction.
NOTE User settings are stored in flash memory. To avoid corrupting the
flash memory, edit these settings infrequently.
Public counter
BeginProg
If counter = 0 Then counter = Settings.UserVal(1)
Scan (1,Sec,0,0)
counter = counter +1
SetSetting ("UserVal(1)",counter)
NextScan
EndProg
E-7
Appendix E. Introduction to CRBasic Programming
DataTable()
'Output Trigger Condition(s)
'Output Processing Instructions
EndTable
A data table is essentially a file that resides in CR300 memory. The file is
written to each time data are directed to that file. The trigger that initiates data
storage is tripped either by the CR300 clock or by an event, such as a high
temperature. The number of data tables is limited to 20. Data tables may store
individual measurements, individual calculated values, or summary data such
as averages, maxima, or minima. See CRBasic Example E-6.
'Declare Variables
Public BattV
Public PTemp_C
Public Temp_C
'Define Units
Units BattV=Volts
Units PTemp_C=Deg_C
Units Temp_C=Deg_C
'Main Program
BeginProg
Scan(1,Sec,1,0)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
'Processing Board Temperature measurement PTemp_C
PanelTemp(PTemp_C,400)
'Type T (copper-constantan) Thermocouple measurement Temp_C
TCDiff(Temp_C,1,mV34,1,TypeT,PTemp_C,True,0,60,1,0)
'Call Data Tables and Store Data
CallTable OneMin
NextScan
EndProg
TABLE 5-2, Typical Data Table (p. 24), shows a data file as it appears after the
data table is downloaded from a CR300 programmed with the code in CRBasic
Example E-6. See Section 5.7, Collecting Data (p. 23), for more information on
final data files.
E-8
Appendix E. Introduction to CRBasic Programming
As shown in CRBasic Example E-6, data table declaration begins with the
DataTable() instruction and ends with the EndTable() instruction. Between
DataTable() and EndTable() are instructions that define what data to store
and under what conditions data are stored. A data table must be called by the
CRBasic program for data storage processing to occur. Typically, data tables
are called by the CallTable() instruction once each Scan.
DataInterval() instructs the CR300 to both write data records at the specified
interval and to recognize when a record has been skipped. The interval is
independent of the Scan() / NextScan interval (p. E-13); however, it must be a
multiple of the Scan() / NextScan interval.
Sometimes timing issues or program logic prevent a record from being written.
If a record is not written, the CR300 recognizes the omission as a "lapse" and
increments the SkippedRecord counter in the Status table. Lapses waste
significant memory in the data table and may cause the data table to fill sooner
than expected. DataInterval() instruction parameter Lapses controls the
CR300 response to a lapse.
E-9
Appendix E. Introduction to CRBasic Programming
Word Size
Name Argument Description Notes Range Resolution
(Bytes)
Single-
precision
IEEE4 or 1.4E45 to 3.4E38
IEEE4 floating 4 IEEE 754 24 bits (about 7 digits)
Float Consecutive Integer: 224
point
number
IEEE 754
Use to minimize
floating point errors
when doing floating
Double- point calculations or to 4.94065E-324 to
IEEE8 or precision store measurements of
IEEE8 8 1.79769E308 53 bits (about 14 digits)
Double floating high-resolution digital Consecutive Integer: 253
point sensors.
Suitable for storing
integers larger than
Longs.
E-10
Appendix E. Introduction to CRBasic Programming
Word Size
Name Argument Description Notes Range Resolution
(Bytes)
Use to store integer
data.
Speed: integer math is
faster than floating point
math.
32-bit Resolution: 32 bits.
Suitable for storing 2,147,483,648 to
Long Long signed 4 1 bit
whole numbers, +2,147,483,647
integer
counting numbers, and
integers in final-data
memory. If storing non-
integers, the fractional
portion of the value is
lost.
Use to store integer
data.
Use to store port or flag
status.
16-bit When Floats convert to
UINT2 UINT2 unsigned 2 UINT2 at final data 0 to 65,535 1 bit
integer storage, values outside
the range 0 65,535
yield unusable data.
INF converts to 65,535.
NAN converts to 0.
Use to store positive
count data
2,147,483,647.
Other uses include
storage of long ID
32-bit
numbers (such as those
UINT4 UINT4 unsigned 4 0 to 4,294,967,295 1 bit
read from a bar reader),
integer
serial numbers, or
address.
May also be required
for use in some Modbus
devices.
Use to store true or false
states, such as states of
flags and control ports.
Any non-zero numeric
value or non-empty
string written to a
Boolean will be stored
Boolean
as True (1). Zero or an True = 1
Boolean Boolean True/False 4 True (-1) or False (0)
empty (nulled) string False = 0
1/0
written to a Boolean
will be stored as False
(0). See Appendix E.9,
Expressions (p. E-15). To
save memory, consider
using UINT2 or
BOOL8.
Memory-efficient
method for storing and
Array of transferring up to 8
eight 1-bit Boolean values.
Bool8 Bool8 1 True = 1, False = 0 True (-1) or False (0)
Boolean Datalogger support
values software expands this
out to 8 individual table
fields.
E-11
Appendix E. Introduction to CRBasic Programming
Word Size
Name Argument Description Notes Range Resolution
(Bytes)
Divided up as four bytes
of seconds since 1990
and four bytes of
NSEC NSEC Time stamp 8 seconds since 1990 1 nanosecond
nanoseconds into the
second. Used to record
and process time data.
See caution.1
String size is defined by
the CR300 operating
system and CRBasic
program.
When converting from
Minimum: 3 String to Float,
(4 with null
numerics at the Unless declared otherwise, string size is 24 bytes or
terminator) beginning of a string characters. String size is allocated in multiples of four
Default: 24 convert, but conversion bytes; for example, String * 25, String * 26, String * 27,
ASCII Maximum: stops when a non-
String String and String * 28 allocate 28 bytes (27 usable). Minimum
string limited only numeric is encountered. string size is 4 (3 usable). See CRBasic Editor Help for
to the size If the string begins with more information. Maximum length is limited only by
of available a non-numeric, the available CR300 memory.
CR300 Float will be NAN. If
memory. the string contains
multiple numeric
values, the SplitStr()
instruction can be used
to parse out the numeric
values. Refer to
CRBasic Editor Help.
1
CAUTION: When using a very long string in a variable declared Public, the operations of datalogger support software will frequently
transmit the entire string over the communication link. If communication bandwidth is limited, or if communications are paid for by the
byte, declaring the variable Dim may be preferred.
E-12
Appendix E. Introduction to CRBasic Programming
'This program example demonstrates the use of the 'disable' variable, or DisableVar, which
'is a parameter in many output processing instructions. Use of the 'disable' variable
'allows source data to be selectively included in averages, maxima, minima, etc. If the
''disable' variable equals -1, or true, data are not included; if equal to 0, or false,
'data are included. The 'disable' variable is set to false (0) by default.
'Main Program
BeginProg
Scan(1,Sec,1,0)
NextScan
EndProg
E-13
Appendix E. Introduction to CRBasic Programming
PanelTemp(Dest,fN1)
'This program example demonstrates the use of a single measurement instruction. In this
'case, the program measures the temperature of the CR300 processing board.
BeginProg
Scan(1,Sec,3,0)
PanelTemp(RefTemp,60) 'Instruction to make measurement
NextScan
EndProg
E-14
Appendix E. Introduction to CRBasic Programming
E.9 Expressions
CRBasic allows for mathematical and logical expressions. Mathematical
operations are written much as they are algebraically. For example, to convert
Celsius temperature to Fahrenheit, the syntax is:
This condition is true only when Condition = 1. If Condition is any other non-
zero, the condition will not be found true because the constant True is
predefined as 1 in the CR300 system memory. By entering = True, a literal
comparison is done. Consider the expression
If Condition Then...
NOTE True is 1 so that every bit is set high (1 is &B11111111 for all
four bytes). This allows the AND operation to work correctly. The
AND operation does an AND Boolean function on every bit, so
True AND X will be non-zero if at least one of the bits in X is
non-zero (if X is not zero). When a variable of data type
BOOLEAN is assigned any non-zero number, the CR300
internally converts it to 1.
E-15
Appendix E. Introduction to CRBasic Programming
With the trigger of TC > 100, a thermocouple temperature greater than 100 sets
the trigger to True and data are stored.
E-16
Campbell Scientific Companies
Campbell Scientific Africa Pty. Ltd. Campbell Scientific Centro Caribe S.A.
PO Box 2450 300 N Cementerio, Edificio Breller
Somerset West 7129 Santo Domingo, Heredia 40305
SOUTH AFRICA COSTA RICA
www.campbellsci.co.za cleroux@csafrica.co.za www.campbellsci.cc info@campbellsci.cc
Please visit www.campbellsci.com to obtain contact information for your local US or international representative.