Sie sind auf Seite 1von 128

OPERATORS MANUAL

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:

Products manufactured by CSI are warranted by CSI to be free from defects in


materials and workmanship under normal use and service for twelve months
from the date of shipment unless otherwise specified in the corresponding
product manual. (Product manuals are available for review online at
www.campbellsci.com.) Products not manufactured by CSI, but that are resold
by CSI, are warranted only to the limits extended by the original manufacturer.
Batteries, fine-wire thermocouples, desiccant, and other consumables have no
warranty. CSIs obligation under this warranty is limited to repairing or
replacing (at CSIs option) defective Products, which shall be the sole and
exclusive remedy under this warranty. The Customer assumes all costs of
removing, reinstalling, and shipping defective Products to CSI. CSI will return
such Products by surface carrier prepaid within the continental United States of
America. To all other locations, CSI will return such Products best way CIP
(port of entry) per Incoterms 2010. This warranty shall not apply to any
Products which have been subjected to modification, misuse, neglect, improper
service, accidents of nature, or shipping damage. This warranty is in lieu of all
other warranties, expressed or implied. The warranty for installation services
performed by CSI such as programming to customer specifications, electrical
connections to Products manufactured by CSI, and Product specific training, is
part of CSI's product warranty. CSI EXPRESSLY DISCLAIMS AND
EXCLUDES ANY IMPLIED WARRANTIES OF MERCHANTABILITY
OR FITNESS FOR A PARTICULAR PURPOSE. CSI hereby disclaims,
to the fullest extent allowed by applicable law, any and all warranties and
conditions with respect to the Products, whether express, implied or
statutory, other than those expressly provided herein.
Assistance
Products may not be returned without prior authorization. The following
contact information is for US and international customers residing in countries
served by Campbell Scientific, Inc. directly. Affiliate companies handle repairs
for customers within their territories. Please visit www.campbellsci.com to
determine which Campbell Scientific company serves your country.

To obtain a Returned Materials Authorization (RMA), contact CAMPBELL


SCIENTIFIC, INC., phone (435) 227-9000. Please write the issued RMA
number clearly on the outside of the shipping container. Campbell Scientifics
shipping address is:

CAMPBELL SCIENTIFIC, INC.


RMA#_____
815 West 1800 North
Logan, Utah 84321-1784

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

3. Initial Inspection ......................................................... 2

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

6.1.2.2 Ratiometric Accuracy ...................................................... 30


6.1.3 Current Measurements ............................................................... 30
6.1.3.1 Voltage Ranges for Current Measurements ..................... 31
6.1.3.2 0-20 mA and 4-20 mA Measurements ............................. 31
6.2 Pulse Measurements .......................................................................... 33
6.3 Period Averaging............................................................................... 34
6.4 Digital Input/Ouput ........................................................................... 34
6.5 Communication ................................................................................. 34
6.5.1 Communication Ports ................................................................. 34
6.5.1.1 USB Port.......................................................................... 34
6.5.1.2 RS-232 Port ..................................................................... 34
6.5.1.3 SDI-12 Ports .................................................................... 35
6.5.1.4 Ethernet Port .................................................................... 35
6.5.2 General Serial Communications ................................................. 35
6.5.2.1 Notes on Com1 ................................................................ 35
6.5.3 SDI-12 Communications ............................................................ 36
6.5.4 Modbus Communications .......................................................... 36
6.5.5 DNP3 Communications ............................................................. 36
6.5.6 PakBus Communications ........................................................... 37
6.5.7 Internet Communications ........................................................... 37
6.6 Memory ............................................................................................. 38
6.6.1 Data Storage ............................................................................... 38
6.6.2 CPU Drive .................................................................................. 38
6.7 Time Keeping .................................................................................... 38
6.8 Grounding ......................................................................................... 38
6.8.1 Lightning Protection................................................................... 39
6.9 Power................................................................................................. 40
6.9.1 Power In ..................................................................................... 40
6.9.1.1 Power Sources ................................................................. 40
6.9.1.2 Power LED Indicator ....................................................... 41
6.9.1.3 Calculating Power Consumption ..................................... 41
6.9.2 Power Out .................................................................................. 42

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

10. Glossary ................................................................... 58


Appendices
A. CR310 Ethernet Communication QuickStart ........ A-1
A.1 Configure the CR310 ...................................................................... A-1
A.2 Set Up LoggerNet or PC400 software............................................. A-3
A.3 Ethernet LED Indicators ................................................................. A-6

B. RF407, RF412, and RF422 Communication


QuickStart............................................................. B-1
B.1 Introduction ...................................................................................... B-1
B.2 Example 1: Computer with RF407 to CR300-RF407 ...................... B-2
B.2.1 Configure the Base Radio ......................................................... B-2
B.2.2 Install the Radio ........................................................................ B-4
B.2.3 Install the Datalogger ................................................................ B-5
B.2.4 Set Up PC200W, PC400, or LoggerNet Software .................... B-6
B.3 Example 2: Computer with RF407 to Multiple CR300-RF407s ...... B-8
B.3.1 Set Unique Datalogger PakBus Addresses ............................... B-9
B.3.2 Install the Dataloggers .............................................................. B-9
B.3.3 Set Up PC200W, PC400, or LoggerNet Software .................. B-10
B.4 Example 3 (LoggerNet Only): Using a CR300-RF407 as a
Router ......................................................................................... B-10
B.4.1 Configure the Router ................................................................. B-10
B.4.2 Install the Dataloggers ............................................................ B-11
B.4.3 Add Routing Datalogger to LoggerNet Network .................... B-11
B.4.4 Add Leaf Dataloggers to LoggerNet Network ........................ B-14
B.5 Communication Combinations....................................................... B-15
B.6 Network Planner ............................................................................ B-16
B.7 Troubleshooting ............................................................................. B-16

C. WIFI Communication QuickStart........................... C-1


C.1 Introduction ...................................................................................... C-1
C.2 Example 1: Create a Network .......................................................... C-1
C.2.1 Configure the Datalogger .......................................................... C-1
C.2.2 Configure the Computer ........................................................... C-2
C.2.3 Set Up LoggerNet or PC400 Software ...................................... C-3
C.2.4 Recommended: Set Network Security ...................................... C-6

iii
Table of Contents

C.2.4.1 Modify Datalogger Settings ........................................... C-6


C.2.4.2 Modify Computer Settings ............................................ C-7
C.3 Example 2: Join a Network ............................................................. C-8
C.3.1 Configure the Datalogger ......................................................... C-8
C.3.2 Set Up LoggerNet or PC400 Software ................................... C-11

D. Importing Short Cut Code Into CRBasic Editor ... D-1


E. Introduction to CRBasic Programming ................ E-1
E.1 Comments ........................................................................................ E-2
E.2 Variables .......................................................................................... E-3
E.2.1 Declaring Data Types ................................................................ E-4
E.2.2 Declaring Arrays ....................................................................... E-5
E.2.3 Conserving Program Memory ................................................... E-6
E.3 Constants .......................................................................................... E-7
E.4 Preserving Variables through User Settings ..................................... E-7
E.5 Data Tables....................................................................................... E-8
E.5.1 Data Output-Processing Instructions ......................................... E-9
E.6 BeginProg / EndProg ...................................................................... E-13
E.7 Scan() / NextScan ........................................................................... E-13
E.8 Programming Instructions .............................................................. E-14
E.8.1 Argument Types ...................................................................... E-15
E.9 Expressions .................................................................................... E-15
E.9.1 Expressions in Arguments ....................................................... E-16

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

E-1. CRBasic Program Structure ............................................................. E-1


E-2. Data Types in Variable Memory ...................................................... E-4
E-3. Data Types in Final Data Memory ................................................. E-10

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.

The CR300 series includes the following dataloggers:


CR300 CR310
CR300-RF407 CR310-RF407
CR300-RF412 CR310-RF412
CR300-RF422 CR310-RF422
CR300-WIFI CR310-WIFI

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.

DANGER: Fire, explosion, and severe-burn hazard. Misuse or improper


installation of the internal lithium battery can cause severe injury. Do not
recharge, disassemble, heat above 100 C (212 F), solder directly to the cell,
incinerate, or expose contents to water. Dispose of spent lithium batteries
properly.

WARNING:

Protect from overvoltage


Protect from water
Protect from ESD (electrostatic discharge)

CAUTION: Disuse accelerates depletion of the internal battery, which


maintains the clock. The internal battery will be depleted in six years or less if
a CR300 remains unpowered. When the CR300 is continuously used, the
internal battery may last up to 10 or more years. See Section 8.3, Internal
Lithium Battery (p. 53), for more information.

IMPORTANT: Maintain a level of calibration appropriate to the application.


Campbell Scientific recommends factory recalibration of the CR300 every
three years.

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.

Immediately check package contents. Thoroughly check all packaging material


for product that may be concealed. Check model numbers, part numbers, and
product descriptions against the shipping documents. Model or part numbers
are found on each product. On cabled items, the number is often found at the
end of the cable that connects to the measurement device. The Campbell
Scientific number may differ from the part or model number printed on the
sensor by the sensor vendor. Ensure that the expected lengths of cables were
received. Contact Campbell Scientific immediately if there are any
discrepancies.

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:

Set up datalogger support software to communicate to a CR300 over a


simple USB connection.

Monitor live data.

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.

Connect a thermocouple to a CR300 to make air temperature


measurements (see note on accuracy).

Send a program to a CR300.

Collect and view recorded data.

4.1 Configure Software


A USB connection is used here, and it is a good way to begin communicating
with your CR300. For more connection types, refer to the following
appendices:
Appendix A, CR310 Ethernet Communication QuickStart (p. A-1)
Appendix B, RF407, RF412, and RF422 Communication QuickStart
(p. B-1)

Appendix C, WIFI Communication QuickStart (p. C-1)

Watch the video for Sections 4.1 4.2: CR300 QuickStart Part 2.

When LoggerNet, PC400, or


PC200W is first run, the EZSetup
Wizard runs automatically in a new
window. If this is not the first time
the software has been run, open the
EZSetup Wizard. Do this by clicking
the Add Datalogger button (shown
on the right).

Click Next.

Select the CR300Series in the


Datalogger Type and Name list.

3
CR300-Series Datalogger

Give the CR300 a name, such as a


site or project name, to identify it
within your software.

Click Next.

LoggerNet and PC400 only:


Select the connection type.

Select Direct Connect.

Click Next.

If this is the first time connecting


your PC to a CR300, click Install
USB Driver to install the USB
driver.

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.

With the CR300 connected to the


PC, a port titled CR300 will appear
in the COM Port list. Select the
CR300 COM Port. The number of
your COM port may differ.

Select the COM Port labeled CR300. Keep all other defaults.

Click Next.

4
CR300-Series Datalogger

Enter the Baud Rate and PakBus


Address. These must match the
hardware settings of your CR300. A
USB connection does not require
selecting a baud rate. The default
PakBus Address is 1.

Keep all default Datalogger Settings.

Click Next.

The CR300 does not use a security


code or a PakBus encryption key by
default, so the Security Code can be
set to 0 and the PakBus Encryption
Key can be left blank. If either
setting has been changed, enter the
new code or key. Security can be set
through Device Configuration
Utility, Connect Screen Settings
Editor, or the SetSecurity()
CRBasic instruction.

Click Next.

Review the software settings in the


Setup Summary.

Click Next.

5
CR300-Series Datalogger

With the USB cable connected, test


the communication settings by
selecting Yes. Click Next to initiate
the test. To troubleshoot an
unsuccessful test, see Section 9,
Troubleshooting (p. 53). Click Next
again after a successful test.

The Datalogger Clock window


shows the current time for both the
CR300 and the PC. Set the
datalogger clock to the Adjusted
Server Date/Time by clicking Set
Datalogger Clock. Apply time
offsets in Time Zone Offset.

Click Next.

The CR300 ships with a default


program called QuickStart.CR300.

If your CR300 is running another


program, the program name will
show in the Current Program
field.

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 .

Keep all default settings.

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 Finish to complete the


EZSetup Wizard and go to the Setup
Screen. A summary of the settings
entered is shown.

4.2 Connect to the CR300


4.2.1 Connect with PC200W or PC400

Select the CR300.

Click Connect.

Click the Monitor Data tab. When


the Monitor Data tab is first opened
for a datalogger, values from the
Public table are displayed.

To view data from other tables, click


Add. Add entire tables or select
fields by dragging them into cells in
the Monitor Data window. Each
table will update as described in
Section 5.6, Monitoring Data (p. 23).

8
CR300-Series Datalogger

Click Disconnect to end the session.

4.2.2 Connect with LoggerNet

Open LoggerNet Connect. From the


LoggerNet toolbar, click Main |
Connect.

In the Stations list, select the newly


added CR300.

Press Connect.

In the Table Monitor, select a data


table in the Table Monitor list. The
table is now displayed. Each table
will update as described in Section
5.6, Monitoring Data (p. 23).

View the Public table by selecting the Public table in the Table Monitor list.

Click Disconnect to end the session.

9
CR300-Series Datalogger

4.3 Create a Program


Short Cut is an easy way to program your CR300 datalogger to measure
sensors. Short Cut is included in installations of LoggerNet. It is also available
as a download on www.campbellsci.com and the ResourceDVD.

This section will guide you through programming a CR300-series datalogger to


measure the voltage of the CR300 power supply, the internal temperature of
the CR300, and a thermocouple. With minor changes, these steps can apply to
other measurements.

Watch the video: CR300 QuickStart Part 3.

Open Short Cut.

LoggerNet:
From the LoggerNet toolbar, click
Program | Short Cut.

Select New Program.

Select the CR300 Series in the


Datalogger Model list.

In the Scan Interval box, enter how


frequently the CR300 should make
measurements.

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

The next window displays


Available Sensors and Devices.
Expand a folder by clicking on the
symbol. Note that the datalogger
battery voltage and internal
temperature (BattV and PTemp_C
in the Selected panel) are selected
by default. Double-click on a sensor
or measurement in the Available
Sensors and Devices list to add it to
the Selected panel.

In the Sensors | Temperature subfolder, double-click Type T (copper-constantan) Thermocouple.

For most sensors and measurements,


a dialog window is then presented
with several fields and options.
Click Help to learn more about any
field or option.

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

After adding the measurement, click


Wiring Diagram to see how the
sensor is to be wired to the
datalogger. Under Progress, click
Sensors to return to the sensor
selection screen.

Wire sensors with power


disconnected. Insert the wire, taking
care to clamp the terminal on the
conductor itself, not the insulation.

CR310 models have standard screw


terminals. To open a terminal on
CR300 models, use the included
flat-blade screwdriver as shown in
the image to the right.

Disconnect the USB cable. Attach the thermocouple to the CR300 as shown in Wiring Diagram.

Click Next.

12
CR300-Series Datalogger

The Outputs page displays the


Selected Sensors list to the left and
data storage tables to the right under
Selected Outputs. Two output
tables (Table1 and Table2 tabs) are
initially available.

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.

Add measurements to the table by


selecting them under Selected
Sensors and then clicking on an
output processing option in the
center column of buttons.

Select BattV under Selected Sensors and then click Average. Repeat this procedure for PTemp_C and Temp_C.

13
CR300-Series Datalogger

Click Finish to compile the


program. Give the program a name.
A summary screen will appear
showing the compiler results. Any
errors during compiling will be
displayed.

Give the program the name MyTemperature. Save it in the default C:\Campbellsci\SCWin folder. Do not send the
program at this time.

If LoggerNet, PC400, or PC200W is


running on your PC, and the PC-to-
datalogger connection is active, you
can choose to send the program. See
Section 4.1, Configure Software (p.
3), for setting up an active PC-to-
datalogger connection with
datalogger support software.

Click No. Do not send the program here. You will do this in Section 4.5, Send a Program (p. 15).

4.4 Wire Sensors and Devices


If the program was created in Short Cut, follow the wiring diagram created by
Short Cut to attach sensors and devices to the datalogger. The wiring must
match the diagram exactly for the sensors to be measured correctly.

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.

CR310 models have standard screw terminals. To open a terminal on CR300


models, use the included flat-blade screwdriver. This is shown in FIGURE 4-1
below.

FIGURE 4-1. Opening a Terminal on CR300 models

14
CR300-Series Datalogger

4.5 Send a Program


Watch the video for Sections 4.5 4.7: CR300 QuickStart Part 4.

Connect to the datalogger as shown


in Section 4.2, Connect to the
CR300 (p. 8).

The Current Program section


shows the program currently
running on the CR300. Click Send
New or Send Program to send a
new program to the datalogger.
Select the program to send, and
click Open.

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.

Sending a program this way erases


all data tables saved on the CR300.
Ensure that all critical data have
been collected. If not, click No, and
collect data before attempting to
send the new program.

Click Yes to confirm that data deletion is OK and to send the program to the CR300.

After the program has successfully


been sent to and compiled by the
CR300, a Compile Results window
opens. Click OK.

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

4.6 Collect Data


After giving the datalogger sufficient time to take multiple measurements,
collect and review the data.

4.6.1 Collect Data with PC200W or PC400

Select the CR300.

Click Connect.

Select the Collect Data tab.

Select an option in What to Collect.


New data from datalogger
(Append to data files)
collects only the data stored
since the last data collection
and appends this data to the
end of the existing file.
All data from datalogger
(Overwrite data files) collects
all of the data in the selected
table and replaces the existing
file.
Both options create a new file
if one does not exist yet.

In the Table list, select the data


table(s) to collect. When they are
collected, they will be written to the
location given in the File Name
column.

Collect new data from the OneMin table.

Click Start Data Collection.

16
CR300-Series Datalogger

After PC200W or PC400 collects


the data, a window titled Data
Collection Results opens. Among
other information, this window
shows the tables collected and
where the tables are now stored on
the computer.

To immediately view data, click


View File. This opens View Pro,
which shows the entire data file. See
Section 4.7, View Data (p. 18).

4.6.2 Collect Data with LoggerNet

Open LoggerNet Connect. From the


LoggerNet toolbar, click Main |
Connect.

In the Stations list, select the newly


added CR300.

Press Collect Now.

Collect data from the OneMin table by clicking Collect Now.

After LoggerNet collects the data, a


window titled Data Collection
Results opens. Among other
information, this window shows the
tables collected and where the tables
are now stored on the PC.

17
CR300-Series Datalogger

To immediately view data, click


View File in the Data Collection
Results window. This opens View
Pro, which shows the entire data
file. See Section 4.7, View Data (p. 18).

4.7 View Data


Open View Pro.

PC200W and PC400: Click the View


Pro icon.
LoggerNet:
From the LoggerNet toolbar, click
Data | View Pro.

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.

Data Table Header

The collected data are now shown.


Learn more about the fields Data Records
displayed in Section 5.7, Collecting
Data (p. 23).

NOTE Check out the View Data Tutorial to learn more.

4.8 Install the CR300


The CR300 and most of its peripherals must be protected from moisture.
Moisture in the electronics will seriously damage the CR300. In most cases,
protection from water is easily accomplished by placing the CR300 in a
weathertight enclosure with desiccant and elevating the enclosure above the
ground. Desiccant in enclosures should be changed periodically.

18
CR300-Series Datalogger

NOTE Do not completely seal the enclosure if lead-acid batteries are


present; hydrogen gas generated by the batteries may build up to
an explosive concentration.

FIGURE 4-2 shows a typical installation using a Campbell Scientific


enclosure. The CR300 has mounting holes through which small screws are
inserted into nylon anchors in the backplate.

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.

FIGURE 4-2. Mounting to a Backplate

4.9 Apply Power


In the field, the CR300 can be powered in any of the following ways:
10 to 16 Vdc applied to the BAT + and terminals, such as a BP7 (pn
17365)
16 to 32 Vdc applied to the CHG + and terminals, such as pn 29796

See Section 6.9, Power (p. 40), for more information.

4.10 Connect to Earth Ground


A good earth connection is necessary to secure the ground potential of the
CR300 and shunt transients away from electronics. In the field, at a minimum,
a proper earth ground will consist of a 5-foot copper-sheathed grounding rod
driven into the earth and connected to the ground lug on the wiring panel with
a 14 AWG wire. The ground lug is the connector with a screw labeled (see
FIGURE 5-1).

19
CR300-Series Datalogger

5. Overview
5.1 Wiring Panel Overview

Earth Earth
Ground Ground

FIGURE 5-1. CR300 (right) and CR310 (left) wiring panels

TABLE 5-1. CR300 Wiring Panel Terminal Definitions

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

10/100 Ethernet (CR310 models) 1


Ether-
Pulse Counting Function C1 C2 P_SW P_LL VX1 VX2 SE1 SE2 SE3 SE4 SE5 SE6 RS-232 SW12 Max
net
Switch Closure 3

High Frequency 8

Low Level AC 1

20
CR300-Series Datalogger

5.2 Configuring the CR300


Settings on the CR300 default to those necessary to communicate with a PC
via USB, RS-232, or Ethernet (on CR310 models), and to accept and execute
user application programs. For other communication methods or more complex
applications, some settings may need adjustment. Settings can be changed
through Device Configuration Utility or through datalogger support software.

Communication peripherals, dataloggers, and software must all be configured


for communication. In addition to this manual and manuals for your specific
peripherals, refer to your datalogger support software manual and help for
guidance.

5.2.1 Device Configuration Utility


The most versatile configuration tool is Device Configuration Utility. It is
bundled with LoggerNet, PC400, and PC200W, and can be downloaded or
updated at www.campbellsci.com/downloads. Device Configuration Utility has
the following basic features:
Provides extensive context-sensitive help
Connects directly to the CR300 over USB, serial, and IP connections
Facilitates access to most settings, status fields, and data table
information registers
Includes a terminal emulator that facilitates access to the command
prompt of the CR300

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.

To save a configuration created in Device Configuration Utility to a file on


your computer, click Summary, and then click Save in the dialog box. The
configuration will save to an .xml file. This file can be used to load a saved
configuration into a CR300 by clicking Read File and Apply.

After configuring the CR300 in Device Configuration Utility, apply the


appropriate communication settings in LoggerNet, PC400, or PC200W. See
Section 5.3, Configuring Datalogger Support Software (p. 22).

5.2.2 Network Planner


When the communication path includes more than just a direct connection to a
datalogger, LoggerNet Network Planner is recommended for the network
setup. This software is included in LoggerNet. Select PakBus devices from a
list and place them on the drawing canvas. Use the Link Tool to draw lines
indicating the communication links between devices. Use the Activity Tool to
indicate activities that will take place between devices.

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

5.3 Configuring Datalogger Support Software


Section 4.1, Configure Software (p. 3), shows the steps for configuring
datalogger support software to communicate with a CR300 over a USB
connection. For other configurations, see the EZSetup Wizard Help. Context-
specific help is given in each step of the wizard by clicking on the Help button
in the bottom right corner of the window. For complex datalogger networks,
use Network Planner (p. 21).

5.4 Writing a Program


A CRBasic program directs the CR300 how and when sensors are to be
measured, calculations made, and data stored. A program is created on a PC
and sent to the CR300. The CR300 can store a number of programs in memory,
but only one program is active at a given time. Two Campbell Scientific
software applications, Short Cut and CRBasic Editor, can be used to create
CR300 programs.

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.

CRBasic Editor is intended for use by programmers who need more


programming flexibility and control than can be provided through Short Cut.
This programming language is similar in syntax, program flow, and logic to the
structured BASIC programming language. CRBasic has special instructions for
making measurements and for creating tables of output data. CRBasic Editor is
a component of LoggerNet and PC400 datalogger support software. For more
on CRBasic programming, refer to Appendix E, Introduction to CRBasic
Programming (p. E-1).

See CRBasic Editor Help for detailed information on program structure,


syntax, and each instruction available to the CR300.

Watch the video: CRBasic | Features.

5.5 Sending a Program


The CR300 requires that a CRBasic program file be sent to its memory to
direct measurement, processing, control, and data storage operations. The
program file may use the extension .CR300 or .dld.

Options for sending a program include the following:


Short Cut
PC200W | Send Program
PC200W | File Control | Send
PC400 | Send Program
PC400 | File Control | Send

22
CR300-Series Datalogger

LoggerNet Connect | Send New


LoggerNet Connect | File Control | Send
LoggerNet Setup
CRBasic Editor | Compile, Save and Send
Device Configuration Utility | Logger Control | Send Program
Device Configuration Utility | File Control | Send
LoggerLink app
LoggerNet Mobile Connect app

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

5.6 Monitoring Data


By default, the CR300 datalogger includes three tables: Public, Status, and
DataTableInfo. Each of these tables only contains the most recent
measurements. The Public table contains the measurements as they are made.
It is updated at the scan interval set within the datalogger program. The Status
table includes information on the health of the datalogger and is updated every
second when viewed. The DataTableInfo table reports statistics related to data
tables. It is also updated every second when viewed. User-defined data tables
update at the schedule set within the program.

Step-by-step instructions for monitoring data are given in Section 4.2, Connect
to the CR300 (p. 8).

5.7 Collecting Data


The CR300 writes to data tables according to the schedule set within the
CRBasic program. After the program has been running for enough time to
generate data records, data may be collected in LoggerNet Connect, PC400, or
PC200W. Collections may be done manually in your datalogger support
software, or automatically through scheduled collections set in LoggerNet
Setup. A good practice is to always retrieve data from the CR300 before
sending a program; otherwise, data may be lost. Step-by-step instructions for
collecting data are given in Section 4.6, Collect Data (p. 16).

5.8 Viewing Data


View historic data in a spreadsheet format within View Pro. View Pro also
contains tools for visualizing data in several graphical layouts. Step-by-step
instructions for viewing data tables are given in Section 4.7, View Data (p. 18).

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.

TABLE 5-2. Typical Data Table

TOA5 CR300Series CR300 142 CR300.Std.01 CPU:MyTemperature.CR300 1958 OneMin


TIMESTAMP RECORD BattV_Avg PTemp_C_Avg Temp_C_Avg
TS RN Volts Deg C Deg C
Avg Avg Avg
2016-03-08 14:24:00 0 0 21.84 20.71
2016-03-08 14:25:00 1 0 21.84 20.63
2016-03-08 14:26:00 2 0 21.84 20.63
2016-03-08 14:27:00 3 0 21.85 20.62
2016-03-08 14:28:00 4 0 21.85 20.52
2016-03-08 14:29:00 5 0 21.85 20.64

Each data table is associated with overhead information, referred to as table


definitions, that becomes part of the file header (first few lines of the file)
when data are downloaded to a PC.

The first header row of the data table is the environment line. It consists of
eight fields, listed in TABLE 5-3.

TABLE 5-3. TOA5 Environment Line

Field Entry in TABLE 5-2 Description Changed By


1 TOA5 Table output format LoggerNet Setup or Connect Custom
Collection | File Format
2 CR300Series Station name Device Configuration Utility or
CRBasic program
3 CR300 Datalogger model
4 142 Datalogger serial number
5 CR300.Std.01 Datalogger OS version New OS
6 CPU:MyTemperature.CR300 Datalogger program name New program
7 1958 Datalogger program signature New or revised program
8 OneMin Table name Revised program

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

If a field is an element of an array, the fieldname will be followed by a list of


subscripts within parentheses that identifies the array index. For example, a
variable named Values, which is declared as a two-by-two array in the
datalogger program, will be represented by four fieldnames: Values(1,1),
Values(1,2), Values(2,1), and Values(2,2). Scalar variables will not have array
subscripts. There will be one value on this line for each scalar value defined by
the table.

If the default fieldnames are not acceptable to the programmer, FieldNames()


instruction can be used in the CRBasic program to customize the names.
TIMESTAMP, RECORD, BattV_Avg, PTemp_C_Avg, and Temp_C_Avg
are the default field names in TABLE 5-2, Typical Data Table (p. 24).

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.

TABLE 5-4. Data Process Abbreviations

Process Name Abbreviation


Totalize Tot
Average Avg
Maximum Max
Minimum Min
Sample at Max or Min SMM
Standard Deviation Std
Moment MMT
Sample No abbreviation
1
Histogram Hst
Histogram4D H4D
FFT FFT
Covariance Cov
Level Crossing LCr
WindVector WVc
Median Med
ET ETsz
Solar Radiation (from ET) RSo
Time of Max TMx
Time of Min TMn
1
Hst is reported in the form Hst,20,1.0000e+00,0.0000e+00,1.0000e+01 where
Hst denotes a histogram, 20 = 20 bins, 1 = weighting factor, 0 = lower bound, 10 =
upper bound.

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.

6.1.1 Voltage Measurements


Sensor connection is to H/L terminals, which are configurable for differential
(DIFF) or single-ended (SE) inputs.
Maximum input voltage range: 100 to +2500 mV
Measurement resolution range: 0.33 to 33 VRMS

Voltage measurements are made using a 24-bit A-to-D converter. A high-


impedance programmable-gain amplifier amplifies the signal. Internal
multiplexers route individual terminals within the amplifier. The CRBasic
measurement instruction controls the A-to-D converter gain and configuration
either single-ended or differential input.

A voltage measurement proceeds as follows:

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.

6.1.1.1 Single-Ended Measurements


A single-ended measurement measures the difference in voltage between the
terminal configured for single-ended input and the reference ground. For
example, single-ended channel 1 is comprised of terminals SE 1 and . Single-
ended terminals are labeled in blue. The CR300 has six SE terminals. The
single-ended configuration is used with the following CRBasic instructions:
VoltSE()
BrHalf()

26
CR300-Series Datalogger

BrHalf3W
TCSE()
Therm107()
Therm108()
Therm109()

6.1.1.2 Differential Measurements


A differential measurement measures the difference in voltage between two
input terminals. For example, DIFF channel 1 is comprised of terminals 1H
and 1L, with 1H as high and 1L as low. The CR300 has three DIFF terminal
pairs. The differential configuration is used with the following CRBasic
instructions:
VoltDiff()
BrFull()
BrFull6W()
BrHalf4W()
TCDiff()

6.1.1.3 Voltage Ranges


In general, use the smallest input range that accommodates the full-scale output
of the sensor. This results in the best measurement accuracy and resolution.
The CR300 has two input ranges for voltage measurements: 100 mV to +2500
mV, and 34 mV to +34 mV.

An approximate 10% overhead on these ranges reduces the chance of


overrange. For example, overrange on the 100 to +2500 mV input range
occurs at approximately 110 mV and 2750 mV. The CR300 indicates a
measurement overrange by returning a NAN (not a number) for the
measurement.

6.1.1.4 Settling Time


The settling time parameter (SettlingTime) is the amount of time to delay after
setting up a measurement and before making the measurement. It defaults to
500 s, with a maximum of 50 ms and a minimum of 10 s.

6.1.1.5 Reverse Differential


Differential measurements have the advantage of an input reversal option,
RevDiff. When RevDiff is set to True, two differential measurements are
made, the first with a positive polarity and the second reversed. Subtraction of
opposite polarity measurements cancels some offset voltages associated with
the measurement.

6.1.1.6 First Notch Frequency


The first notch frequency (fN1) determines the lowest frequency that will be
eliminated, or notched out, by a sinc filter. This filter notches out frequencies at
integer multiples of fN1 by averaging for a time equal to 1/ fN1. Thus, lower first
notch frequencies result in longer measurement times.

Options for filtering noise are:


4000 for fast measurements, 0.5-ms analog-to-digital conversion
time

27
CR300-Series Datalogger

400 6.226-ms analog-to-digital conversion time


50/60 filters 50 and 60 Hz noise, 49.812-ms analog-to-digital
conversion time

Campbell Scientific offers terminal input modules (TIMs), which provide


completion resistors for resistive-bridge measurements.

6.1.2 Resistance Measurements


Bridge resistance is determined by measuring the difference between a known
voltage applied to the excitation (input) of a resistor bridge and the voltage
measured on the output arm. The CR300 supplies a precise voltage excitation
via VX terminals. Return voltage is measured on H/L terminals configured for
single-ended (SE) or differential (DIFF) input. The result of the measurement
is a ratio of measured voltages, as shown in TABLE 6-1.

CRBasic instructions for measuring resistance include:

BrHalf() half-bridge
BrHalf3W() three-wire half-bridge
BrHalf4W() four-wire half-bridge
BrFull() four-wire full-bridge
BrFull6W() six-wire full-bridge

TABLE 6-1. Resistive-Bridge Circuits with Voltage Excitation

Resistive-Bridge Type and CRBasic Instruction and


Circuit Diagram Fundamental Relationship
Half-Bridge1

CRBasic Instruction: BrHalf()

Fundamental Relationship2:

1
= =
+

28
CR300-Series Datalogger

TABLE 6-1. Resistive-Bridge Circuits with Voltage Excitation

Resistive-Bridge Type and CRBasic Instruction and


Circuit Diagram Fundamental Relationship
Three-Wire Half-Bridge1,3

CRBasic Instruction: BrHalf3W()

Fundamental Relationship2:

22 1
= =
1

Four-Wire Half-Bridge1,3

CRBasic Instruction: BrHalf4W()

Fundamental Relationship2:

2
= =
1

Full-Bridge1,3

CRBasic Instruction: BrFull()

Fundamental Relationship2:

1 3 2
= 1000 = 1000
3 + 4 1 + 2

29
CR300-Series Datalogger

TABLE 6-1. Resistive-Bridge Circuits with Voltage Excitation

Resistive-Bridge Type and CRBasic Instruction and


Circuit Diagram Fundamental Relationship
Six-Wire Full-Bridge1

CRBasic Instruction: BrFull6W()

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.

6.1.2.1 Voltage Excitation


VX terminals supply precise voltage in the range of 150 to 5000 mV. The two
VX terminals source up to 50 mA total when used concurrently, or 50 mA each
when used independently.

NOTE The CR300 is not capable of applying reverse excitation. Set the
RevEx parameter of all bridge measurement instructions to False.

6.1.2.2 Ratiometric Accuracy


See also: Section 7.2, Resistance Measurements (p. 44).

The accuracy specifications for ratiometric-resistance measurements are


summarized below:

0 to 40 C: (0.05% of voltage measurement + offset)

40 to 70 C: (0.06% of voltage measurement + offset)

These specifications are based on a calibrated CR300. They do not include


bridge resistor errors or sensor measurement noise, and they assume input
reversal for differential measurements (RevDiff).

6.1.3 Current Measurements


Terminals SE1 and SE2 can be configured to make analog current
measurements. Each of the two terminals can independently measure 0 25
mA. When configured to measure current, terminals SE1 and SE2 each have
an internal resistance of 140 which is placed in the current measurement
loop. The return path of the sensor must be connected directly to the analog

30
CR300-Series Datalogger

ground () closest to the terminal used. FIGURE 6-1 shows a simplified


schematic of a current measurement.

FIGURE 6-1. CR300 Current Measurement

Use a CURS100 terminal input module to achieve more isolated loop


measurements or when an application needs more than 2 current inputs or
measurements.

6.1.3.1 Voltage Ranges for Current Measurements


The CR300 measures the current through the use of a 100 resistor. Thus, like
a single-ended voltage instruction, it requires a voltage range option. In
general, use the smallest fixed-input range that accommodates the full-scale
output of the transducer. This results in the best measurement accuracy and
resolution. The CR300 has two fixed input voltage ranges: 100 to +2500 mV,
and 34 to +34 mV.

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.

An approximate 10% overhead on voltage input ranges reduces the chance of


overrange. For example, overrange on the 100 to +2500 mV input range
occurs at approximately 110 mV and 2750 mV. The CR300 indicates a
measurement overrange by returning a NAN for the measurement.

6.1.3.2 0-20 mA and 4-20 mA Measurements


TABLE 6-2 shows example schematics for connecting typical 0 20 mA and
4 20 mA sensors and devices.

TABLE 6-2. 020 mA and 420 mA Sensor Example Connections

2-wire transducer using


datalogger power

31
CR300-Series Datalogger

TABLE 6-2. 020 mA and 420 mA Sensor Example Connections

2-wire transducer using


external power

3-wire transducer using


datalogger power

3-wire transducer using


external power

4-wire transducer using


datalogger power

32
CR300-Series Datalogger

TABLE 6-2. 020 mA and 420 mA Sensor Example Connections

4-wire transducer using


external power

6.2 Pulse Measurements


The output signal generated by a pulse sensor is a series of voltage waves. The
CR300 includes terminals that are configurable for pulse input to measure
counts or frequency as illustrated in FIGURE 6-2.

FIGURE 6-2. Pulse Signal Types

Pulse input terminals and the input types they can measure are shown in
TABLE 6-3.

TABLE 6-3. Pulse Measurement Input Types, Terminals,


and Data Options

Input Type Pulse Input Terminal Data Option


SE 1-4
C1-C2
High-frequency Counts
P_SW
P_LL Frequency
Low-level AC P_LL Running average of
frequency
P_SW
Switch-closure
C1-C2

33
CR300-Series Datalogger

6.3 Period Averaging


SE terminals 1-4 on the CR300 are also configurable for measuring the period
of a digital signal. The specified number of cycles is timed with a resolution of
13 ns, making the resolution of the period measurement 13 ns divided by the
number of cycles chosen. The signal transition thresholds are <0.9 V and
>2.1 V. Every signal below 0.9 V is detected as low, and every signal above
2.1 V is detected as high. Signals between 0.9 and 2.1 V are indeterminate.

Period-average measurements use a high-frequency digital clock to measure


time differences between signal transitions, whereas pulse-count measurements
simply accumulate the number of counts. As a result, period-average
measurements offer much better frequency resolution per measurement
interval, as compared to pulse-count measurements.

Maximum frequency: 200 kHz

Resolution: 13 ns number of cycles to be measured

6.4 Digital Input/Ouput


Terminals C1, C2, P_SW, and SE 1-4 can be configured for digital input or
output. As input terminals, they can measure the state, low (0 V) or high
(threshold 3.3 V), of an input. As output terminals, they can be set low (0 V) or
high (SE 1-4 and P_SW to 3.3 V, and C1-C2 to 5 V). With limited drive
capacity, digital output terminals are normally used to operate external relay-
driver circuits. Drive current and high-state voltage levels vary between
terminals. See TABLE 7-6, Digital I/O Voltage Levels (p. 47).

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).

6.5.1.2 RS-232 Port


One nine-pin DCE port, labeled RS-232, normally used to communicate with a
PC running datalogger support software, to connect a modem, or to read a
smart sensor (see Section 6.5.2, General Serial Communications (p. 35)). With a
null modem adapter attached, it serves as a DTE device.

34
CR300-Series Datalogger

6.5.1.3 SDI-12 Ports


SDI-12 is a 1200-baud protocol that supports many smart sensors (see Section
6.5.3, SDI-12 Communications (p. 36)). C1 and C2 can each be configured as an
SDI-12 communication port.

6.5.1.4 Ethernet Port


CR310 models include one RJ45 10/100 Ethernet port used for IP
communications.

6.5.2 General Serial Communications


The CR300 supports two-way serial communication through two ports
configurable for RS-232 input. In addition to the nine-pin RS-232 port,
terminals C1 and C2 can be configured as a pair to create an RS-232
communication port, called Com1. Ports can be formatted as described in
CRBasic Editor Help.

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.

CRBasic instructions for general serial communications include:


SerialOpen()
SerialClose()
SerialIn()
SerialInRecord()
SerialInBlock()
SerialOut()
SerialOutBlock()

To communicate over a serial port, it is important to be familiar with the


protocol of the sensor or device. Refer to the manual of the sensor or device to
find its protocol and then select the appropriate options for each CRBasic
parameter. See the application note Interfacing Serial Sensors with Campbell
Scientific Dataloggers, available at www.campbellsci.com, for more
programming details and examples.

6.5.2.1 Notes on Com1


Though Com1 uses RS-232 logic levels, it is limited to outputting 0 V
(logic high) to 5 V (logic low). This may make Com1 incompatible with
some serial devices.

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

6.5.3 SDI-12 Communications


SDI-12 is a smart-sensor protocol that uses one terminal configured for SDI-
12. Terminals C1 and C2 can each be configured as an SDI-12 communication
terminal.

The CR300 can be programmed to act as an SDI-12 data recorder or as an SDI-


12 sensor. The SDI12Recorder() instruction automates sending commands
and recording responses. With this instruction, the commands to poll sensors
and retrieve data are done automatically with proper elapsed time between the
two. The CR300 automatically issues retries. See CRBasic Editor Help for
more information on this instruction.

CRBasic SDI-12 instructions include:


SDI12Recorder()
SDI12SensorSetup()
SDI12SensorResponse()

6.5.4 Modbus Communications


The CR300 series supports Modbus RTU, Modbus ASCII, and Modbus TCP
protocols and can be programmed as a Modbus master or Modbus slave. These
protocols are often used in Modbus SCADA networks. The CR300 series can
communicate with Modbus on all available communication ports.

Modbus has a set command structure. It uses a common bus and addresses each
node.

CRBasic Modbus instructions include:


ModbusMaster()
ModbusSlave()
MoveBytes()

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.

6.5.5 DNP3 Communications


DNP3 (Distributed Network Protocol) is designed to optimize transmission of
data and control commands from a master computer to one or more remote
devices or outstations. The CR300 series allows DNP3 communication on all
available communication ports. See the application note DNP3 with Campbell
Scientific Dataloggers, available at www.campbellsci.com, for detailed
information and program examples.

CRBasic DNP3 instructions include:


DNP()
DNPUpdate()
DNPVariable()

36
CR300-Series Datalogger

6.5.6 PakBus Communications


PakBus is a protocol similar in concept to IP (Internet Protocol). By using
signatured data packets, PakBus increases the number of communication and
networking options available to the CR300. The CR300 series allows PakBus
communication on all available communication ports. Advantages of PakBus
are as follows:
Simultaneous communication between the CR300 and other devices.
Peer-to-peer communication no PC required. Special CRBasic
instructions simplify transferring data between dataloggers for
distributed decision making or control.
Data consolidation other PakBus dataloggers can be used as
"sensors" to consolidate all data into one CR300.
Routing the CR300 can act as a router, passing on messages
intended for another Campbell Scientific datalogger. PakBus supports
automatic route detection and selection.
Short distance networks a CR300 can talk to another CR300 over
distances up to 30 feet by connecting transmit, receive, and ground
wires between the dataloggers.

In a PakBus network, each datalogger is set to a unique address. The default


PakBus address in most devices is 1. To communicate with the CR300, the
datalogger support software must know the CR300 PakBus address. The
PakBus address is changed using Device Configuration Utility, CR300 Status
table, or PakBus Graph software.

CRBasic PakBus instructions include:


GetDataRecord()
GetVariables()
SendData()
SendGetVariables()
SendVariables()

6.5.7 Internet Communications


The internet protocols listed in Section 7.10, Communication (p. 48), are
supported by the CR310 or when using a cell modem with the CR300. The
most up-to-date information on implementing these protocols is contained in
CRBasic Editor Help.

CRBasic instructions for internet communications include:


EmailRelay() HTTPPut
EmailSend() IPInfo()
EmailRecv() PPPOpen()
FTPClient() PPPClose()
HTTPGet() TCPOpen()
HTTPOut() TCPClose()
HTTPPost()

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.

6.6.1 Data Storage


During data table initialization, sectors are assigned to each data table
according to the parameters set in the program. Program options that affect the
allocation of memory include the Size parameter of the DataTable()
instruction, the Interval and Units parameters of the DataInterval()
instruction, and the Interval and Units parameters of the Scan() instruction.
The CR300 uses those parameters to assign sectors in a way that maximizes the
life of its memory.

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.6.2 CPU Drive


The CPU drive contains datalogger programs and other files. It holds a copy of
final-data memory when the TableFile() instruction is used. It provides
memory for FileRead() and FileWrite() operations. This memory is managed
in File Control (p. 59). When writing to files under program control, take care to
write infrequently in order to prevent premature failure of serial flash memory.

6.7 Time Keeping


Measurement of time is an essential function of the CR300. Time measurement
with the onboard clock enables the CR300 to attach time stamps to data,
measure the interval between events, and time the initiation of control
functions. Clock accuracy is 1 minute per month, with a resolution of 1 ms.
An internal lithium battery backs the clock when the datalogger is not
externally powered (see Section 8.3, Internal Lithium Battery (p. 53)).

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.

In the field, at a minimum, a proper earth ground will consist of a 5-foot


copper-sheathed grounding rod driven into the earth and connected to the large
brass ground lug on the wiring panel with a 14 AWG wire. In low-conductive
substrates, such as sand, very dry soil, ice, or rock, a single ground rod will
probably not provide an adequate earth ground. For these situations, search for
published literature on lightning protection or contact a qualified lightning-
protection consultant.

In laboratory applications, locating a stable earth ground is challenging, but


still necessary. In older buildings, new Vac receptacles on older Vac wiring
may indicate that a safety ground exists when, in fact, the socket is not
grounded. If a safety ground does exist, good practice dictates the verification
that it carries no current. If the integrity of the Vac power ground is in doubt,
also ground the system through the building plumbing, or use another verified
connection to earth ground.

6.8.1 Lightning Protection

NOTE Lightning strikes may damage or destroy the CR300 and


associated sensors and power supplies.

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

FIGURE 6-3. Lightning Protection Scheme

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.

CHG terminals voltage input range is 16 to 32 Vdc. Connect a primary


power source, such as a solar panel or Vac-to-Vdc transformer, to CHG. The
voltage applied to CHG terminals must be at least 0.3 V higher than that
needed to charge a connected battery. When within the 16 to 32 Vdc range, it
will be regulated to the optimal charge voltage for a lead acid battery at the
current datalogger temperature, with a maximum voltage of 15 Vdc. A battery
need not be connected to the BAT terminals to supply power to the datalogger

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.

The CR300 is internally protected against accidental polarity reversal on the


power terminals. Sustained input voltages in excess of 33 V at the BAT or
CHG terminals can damage the CR300.

6.9.1.2 Power LED Indicator


When the CR300 is powered, the red Power LED will turn on according to
power and program states. See TABLE 6-4.

TABLE 6-4. Power LED Activity

LED State Power State Program State


Off No power Not running
1 flash every 10 seconds Powered Running
3 flashes every 10 seconds Powered via USB Running
Always On Powered Not running

6.9.1.3 Calculating Power Consumption


In low-power situations, the CR300 can operate for several months on non-
rechargeable batteries. Power systems for longer-term remote applications
typically consist of a charging source, a charge controller, and a rechargeable
battery. When AC line power is available, a Vac-to-Vdc wall adapter, the on-
board charging regulator, and a rechargeable battery can be used to construct
an uninterruptible power supply (UPS).

When designing a power supply, consider the worst-case power requirements


and environmental extremes. For example, the power requirement of a weather
station may be substantially higher during extreme cold, while at the same
time, the extreme cold constricts the power available from the power supply.
System operating time for batteries can be determined by dividing the battery
capacity (ampere hours) by the average system current drain (amperes). The
CR300 typically has a quiescent current drain of 1.5 mA and a current drain of
5 mA when running a 1 Hz scan with analog measurements.

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

6.9.2 Power Out


The CR300 includes many terminals to supply voltage and control for sensors
and devices.
150 to 5000 mV output VX terminals supply 150 to 5000 mV.
They source 50 mA each, or 50 mA combined when used
concurrently.
3.3 V control Configured for control, SE terminals 1-4 supply 3.3
V. Voltage will drop to 3.0 V when sourcing 100 A.
5 V control Control terminals C1 and C2 supply 5 V. Voltage will
drop to 3.5 V when sourcing 10 mA.
Switched 12 V The SW12V terminal provides unregulated 12 V
and will source 1100 mA. The voltage on this terminal fluctuates with
the supply used to power the CR300.
Continuous 12 V Bat + and provide a connection to the
unregulated, nominal 12 V battery. It may rise above or drop below
the power requirement of the sensor or peripheral. Take precautions to
prevent damage to sensors or peripherals from over- or undervoltage
conditions, and to minimize the error associated with the measurement
of underpowered sensors.

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

Ranges: 100 to +2500 mV


34 to +34 mV

Accuracy1,2
0 to 40 C: (0.04% of reading + Offset3)
40 to 70 C: (0.1% of reading + Offset3)

Resolution: See TABLE 7-1, Analog Voltage


Measurement Range and Resolution (p. 43)

Speed: See TABLE 7-3, Analog Voltage


Measurement Speed (p. 44)

Input Resistance: See TABLE 7-4, Analog Voltage


Measurement Input Resistance and
Current (p. 44)

Input Limits: 100 to 2500 mV

42
CR300-Series Datalogger

Maximum Input Voltage


SE 1-2: 6 V, +9 V
SE 3-6: 17 V

DC Common-Mode Rejection: >120 dB with input reversal


90 dB without input reversal

Normal-Mode Rejection: >71 dB at 60 Hz


>74 dB at 60 Hz

Input Current: See TABLE 7-4, Analog Voltage


Measurement Input Resistance and
Current (p. 44)
1Accuracyspecification does not include sensor error or measurement noise.
2Assumesinput reversal for differential measurements.
3See TABLE 7-2, Analog Voltage Measurement Accuracy Offsets

TABLE 7-1. Analog Voltage Measurement Range and Resolution

Typical Effective Resolution3


Differential Differential
Measurements Measurements
with Input without Input
Reversal Reversal
fN11 Range2
(Hz) (mV) RMS (V) bits RMS (V) bits
100 to +2500 23 16.8 33 16.3
4000
34 to +34 3.0 14.5 4.2 14.0
100 to +2500 3.8 19.4 5.4 18.9
400
34 to +34 0.58 16.8 0.82 16.3
100 to +2500 1.6 20.6 2.3 20.1
50/60
34 to +34 0.23 18.2 0.33 17.7
1Firstnotch frequency
2Range overhead of 10% on all ranges guarantees that full-scale values will not
cause overrange.
3Effective resolution (ER) in bits is computed from the ratio of full-scale range to

RMS noise, where RMS noise is the standard deviation of many measurements of
grounded inputs.

TABLE 7-2. Analog Voltage Measurement Accuracy Offsets

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

TABLE 7-3. Analog Voltage Measurement Speed1,2

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.

TABLE 7-4. Analog Voltage Measurement Input Resistance and Current

fN1 Input Resistance Input Current at 25 C


(Hz) (G) (nA)
4000 0.3 13
50/60 5 0.8

7.2 Resistance Measurements


Four- and six-wire full-bridge and two-, three-, and four-wire half-bridge
measurements using voltage excitation.

Terminals: SE terminals 1-6


DIFF terminals 1H/1L - 3H/3L
Excitation terminals VX1-VX2

Ratiometric Accuracy1,2,3

0 to 40 C: (0.05% of voltage measurement + offset)


40 to 70 C: (0.06% of voltage measurement + offset)
1Assumes input reversal for differential measurements.
2Does not include bridge-resistor errors and sensor measurement noise.
3Ratiometric accuracy, rather than absolute accuracy, determines overall measurement

accuracy of ratiometric resistance measurements.

7.3 Voltage Excitation


Two terminals configured for voltage excitation using 12-bit D-to-A converter.
When used for ratiometric-resistance measurement, excitation is active only
during measurement.

44
CR300-Series Datalogger

Terminals: VX1-VX2

Range: 150 to 5000 mV

Resolution: 4.5 mV

Maximum Source
or Sink Current: 50 mA total, concurrently or independently

7.4 Current Measurements


Two independent analog inputs may be configured as independent, non-
isolated 0-20 mA or 4-to-20 mA current-loop inputs. One channel at a time is
measured in numeric succession. Current is measured using a 24-bit A-to-D
converter.

Terminals: SE terminals 1-2

Range: 0 to 25 mA

Accuracy
0 to 40 C: 0.14% of reading
40 to 70 C: 0.26% of reading

7.5 Pulse Measurements


7.5.1 Switch-Closure Input
Terminals: P_SW
C1-C21

Minimum Switch-Closed Time: 3 ms

Minimum Switch-Open Time: 3 ms

Maximum Bounce Time: 1 ms open without being counted

Maximum Input Frequency: 150 Hz

Maximum Input Voltage: 17 Vdc


1Requires an external 100 k resistor connected from the terminal to BAT+.

7.5.2 High-Frequency Input


Terminals: SE terminals 1-4
P_LL
P_SW
C1-C2
Maximum Input Frequency
SE 1-4: 35 kHz
P_LL: 20 kHz
P_SW: 35 kHz
C1-C2: 3 kHz

45
CR300-Series Datalogger

7.5.3 Low-Level AC Input


Terminal: P_LL

Range: See TABLE 7-5, Low-Level AC


Ranges (p. 46)

Input Hysteresis: 12 mV at 1 Hz

TABLE 7-5. Low-Level AC Ranges1

Sine Wave Input Range


(mVRMS) (Hz)
20 1.0 to 20
200 0.5 to 200
2000 0.3 to 10,000
5000 0.3 to 20,000
1AC coupling removes AC offsets up to 0.05 V

7.6 Period Averaging


Up to four analog inputs may be configured for period averaging.

Terminals: SE terminals 1-4

Frequency Range: 5 Hz to 200 kHz

Voltage Range: 0 to 3.3 V

Accuracy: (0.01% of reading + resolution)

Resolution: 13 ns number of cycles

Minimum Pulse Width: 2.5 s

Voltage Threshold: Counts cycles on transition from <0.9 Vdc to


>2.1 Vdc

7.7 Digital Input/Output


Up to six terminals may be configured for digital inputs or outputs (I/O).

Terminals: SE terminals 1-4


P_SW
C1-C2

46
CR300-Series Datalogger

TABLE 7-6. Digital I/O Voltage Levels

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

7.8 Switched Voltage Output


One unregulated voltage output terminal is switched under program control.

Switched 12 Vdc (unregulated)1


Terminal: SW12V
Thermal Fuse Hold Current: See TABLE 7-7, SW12V Thermal
Fuse Hold Current (p. 47)

Continuous Analog Output2: See Section 7.3, Voltage Excitation


(p. 44)

Control Output: See Section 7.7, Digital


Input/Output (p. 46)

TABLE 7-7. SW12V Thermal Fuse Hold Current

Temperature Current Limit


(C) (mA)
40 1200 (6701)
20 1100 (5001)
70 830 (2901)
1Applies to serial numbers lower than 2813.

1Nonoperational under USB power.


2Range reduced to 150 to 2500 mV when under USB power.

47
CR300-Series Datalogger

7.9 Pulse-Width Modulation


Terminals: SE terminals 1-4

Period Maximum: 2047 ms

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.

Data File Formats: CSV, XML, JSON, binary

USB: USB micro-B device only, 2.0 full-speed 12


Mbps, for computer connection.

RS-232: Female RS-232, 9-pin interface


1200 to 115.2 kbps

Serial: One TX/RX pair (terminals C1/C2)


0 to 5 V output, 3.3 V input
1200 to 115.2 kbps

SDI-12: Two independent SDI-12 V1.3 compliant


terminals (C1, C2) configurable as sensor or
recorder

7.11 System
Operating Temperature: 40 to 70 C

Processor: ARM Cortex M4 running at 144 MHz

Memory: See TABLE 7-8, Memory Size and Allocation


(p. 49)

Clock Accuracy: 1 minute per month

Clock Resolution: 1 ms

Program Execution Interval: 100 ms to 1 day

48
CR300-Series Datalogger

TABLE 7-8. Memory Size and Allocation

Memory Size Type Storage

80 MB Datalogger Programs, Other


CPU Drive Serial Flash
(5 MB1) Files

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.

7.12 Power Requirements


Power specifications for a communication option are shown within the
specifications section for that option.

Charger Input: CHG+ and CHG- terminals


16 32 Vdc
Current limited to 0.9 A maximum
Power converter or solar panel input

External Batteries: BAT+ and BAT- terminals


10 16 Vdc input
12 Vdc, lead-acid 7 Ah battery, typical

Internal Lithium Battery: 3 V coin cell CR2016 (Energizer) for battery-


backed clock
6-year life with no external power source

Typical Power Requirements


Sleep: 1.5 mA
Active
1 Hz Scan with 1
Analog Measurement: 5 mA
Processor Always On: 23 mA

USB Power: For programming and limited functionality.


VX1 VX2 range reduced to 150 to 2500 mV.
SW12V nonoperational. Control ports output
4.75 V with limited current.

49
CR300-Series Datalogger

7.13 Compliance
View EU Declarations of Conformity at www.campbellsci.com/cr300 and
www.campbellsci.com/cr310.

Shock and Vibration: ASTM D4169-09

Protection: IP30

RF407 Option: United States FCC Part 15.247:


MCQ-XB900HP
Industry Canada (IC): 1846A-XB900HP
RF412 Option: ACMA RCM
United States FCC Part 15.247:
MCQ-XB900HP
Industry Canada (IC): 1846A-XB900HP
RF422 Option: View the CR300 series RF422 radio option
EU Declaration of Conformity at
www.campbellsci.com/cr300 and
www.campbellsci.com/cr310

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

CR300: 242 g (0.53 lb)


CR310: 288 g (0.64 lb)
CR300-WIFI/RF407/
RF412/RF422: 249.5 g (0.55 lb)
CR300-WIFI/RF407/
RF412/RF422: 306 g (0.68 lb)

Case Material: Powder-coated aluminum

7.15 CR310 Ethernet Communication


Ethernet Port: RJ45/jack, 10/100Base-TX, full and half duplex Auto-
MDIX Magnetic isolation and TVS surge protection

Ethernet Power Requirements


Port Off: See Typical Power Requirements in
Section 7.12, Power Requirements (p. 49)
Port On, Idle: 32 mA
Active: 51 mA

50
CR300-Series Datalogger

7.16 RF407, RF412, and RF422 Radio Options


Antenna Connector: Reverse Polarity SMA (RPSMA)

RF407 RF412 RF422


Radio Type Frequency Hopping Spread Spectrum (FHSS) SRD860, LBT + AFA
Frequency 902 to 928 MHz 915 to 928 MHz 863 to 870 MHz
Transmit Power Output1 5 to 250 mW 2 to 25 mW
Channel Capacity Eight 25-channel hop Eight 25-channel hop
Ten 30-channel hop
sequences sharing 64 sequences sharing 31
sequences2
available channels available channels
Receiver Sensitivity 101 dBm 106 dBm
RF Data Rate 200 kbps 10 kbps
Average Additional Current
Contribution at 12 Vdc
Transmit 45 mA 20 mA
Idle On 12 mA 9.5 mA
Idle 0.5 sec Power Mode 4 mA 3.5 mA
Idle 1 sec Power Mode 3 mA 2.5 mA
Idle 4 sec Power Mode 1.5 mA 1.5 mA
1Software selectable
230channels (default), software configurable to meet local regulations; 10 sequences for reducing interference through
channel hop

7.17 WIFI Option


Maximum Possible
Throughput: 30 Mbps

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

Operating Frequency: 2.4 GHz, 20 MHz bandwidth

Antenna Connector: Reverse Polarity SMA (RPSMA)

Supported Standards: EEE 802.11 b/g/n, IEEE 802.11d/e/I, 802.1X,


WEP, WPA/WPA2-Personal and Enterprise

Operational Modes: Client or Access Point

Transmit Power: 7 to 18 dBm

Rx Sensitivity: 97 dBm

51
CR300-Series Datalogger

Average Additional Current


Contribution at 12 Vdc
Client Mode: 7 mA idle, 70 mA communicating
Access Point Mode: 62 mA idle, 65 mA communicating
Sleep: 4 mA

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.

If sending the CR300 to Campbell Scientific for calibration or repair, consult


first with Campbell Scientific. If the CR300 is malfunctioning, be prepared to
perform some troubleshooting procedures. Many problems can be resolved
with a telephone conversation. If calibration or repair is needed, the procedure
shown in the Assistance page at the beginning of this manual should be
followed when sending the product.

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:

the importance of the measurements


how long the datalogger will be used
the operating environment
how the datalogger will be handled

8.2 Sending an Operating System


Campbell Scientific posts operating system (OS) updates at
www.campbellsci.com/downloads when they become available. Before
deploying instruments, check operating system versions and update as needed.
The CR300 operating system version is shown in the Status table, Station
Status Summary, and Device Configuration Utility Deployment |
Datalogger. An operating system may be sent through Device Configuration
Utility or through program-send procedures.

Sending an operating system through Device Configuration Utility resets all


settings on the datalogger to factory defaults and clears its memory. To send an
OS through Device Configuration Utility, follow the procedure on the Send OS
tab.

Watch the video: Sending an OS to a (local) datalogger Part 1.

In most instances, sending an operating system as a program preserves settings.


This allows for sending an operating system remotely; however, this should be
done with great caution as updating the OS may reset the CR300 settings, even
settings critical to supporting the telecommunication link. To send an OS this

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).

Watch the video: Sending an OS to a (remote) datalogger Part 2.

Note the following precautions when sending as a program:


Because sending an OS resets CR300 memory, data loss will certainly
occur. Depending on several factors, the CR300 may also become
incapacitated for a time.
While the programs are retained in memory, no program will be set to
run after the operating system is sent. To overcome this, create a
default.CR300 program and store it on the CR300. Default.cr300
can be edited to preserve critical datalogger settings, such as
communication settings, but cannot be more than a few lines of code.
Any peripherals being powered through the SW12V terminal will be
turned off until the program logic turns them on again.
Operating systems are very large files. Be cautious of data charges.

8.3 Internal Lithium Battery


The lithium battery powers the clock of the datalogger when the datalogger is
not powered. If the LithiumBattery field in the Status table indicates a battery
failure or if the clock can no longer be set, then the lithium battery should be
replaced. The internal lithium battery has a six-year life when no external
power source is applied. Its life is extended when the CR300 is installed with
an external power source applied. The battery is replaced during regular factory
recalibration, which is recommended every 3 years. To replace the lithium
battery, please contact Campbell Scientific.

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

FIGURE 9-1. Station Status Window

54
CR300-Series Datalogger

TABLE 9-1. Troubleshooting with Station Status

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.

9.2 Basic Troubleshooting Procedure


The following basic procedure can be used if a system is not operating
properly.

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

2. Check wires and cables for the following:


a. Incorrect wiring connections. Make sure each sensor and device
are wired to the channels assigned in the program. If the program
was written in Short Cut, check wiring against the generated
wiring diagram. If written in CRBasic Editor, check wiring
against each measurement and control instruction.
b. Loose connection points
c. Faulty connectors
d. Cut wires
e. Damaged insulation, which allows water to migrate into the
cable. Water, whether or not it comes in contact with wire, can
cause system failure. Water may increase the dielectric constant
of the cable sufficiently to impede sensor signals, or it may
migrate into the sensor, which will damage sensor electronics.

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.

9.3 NAN and INF


NAN (not a number) and INF (infinite) are data words indicating an
exceptional occurrence in datalogger function or processing. INF indicates that
the program has encountered an arithmetic expression that is undefined.

A NAN indicates an invalid measurement. NANs are expected in the following


conditions:

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.

NAN is a constant that can be used in expressions. This is shown in the


following code snip that sets a CRBasic control feature (a flag) if the wind
direction is NAN:

If WindDir = NAN Then


WDFlag = False
Else
WDFlag = True
EndIf

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.

Because NAN is a constant, it can be used in conjunction with the disable


variable parameter (DisableVar) in output processing instructions. Use the
DisableVar parameter to call the output table conditionally (for example, do
not call the table if a variable = NAN) to keep NANs from affecting the other
good values.

9.4 Out of Memory Error


When the datalogger gives an Out of memory error upon program compile, it
means that there is no unused continuous section of memory large enough to fit
an element of the program. The most common cause of this error is a large
variable array. In that case, split the large array into smaller arrays until the
datalogger compiler accepts the program.

9.5 Resetting the CR300


Sometimes the easiest way to resolve a problem is by resetting the datalogger.

To completely reformat the CR300, send an operating system through the


Device Configuration Utility Send OS tab. This erases all programs and data
and restores each setting to its factory default (see Section 8.2, Sending an
Operating System (p. 52)).

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:

Terminal Emulator Enter the CR300 terminal mode and type


REBOOT <Enter>. Type YES <Enter> when prompted.

57
CR300-Series Datalogger

CRBasic program Use the RESTART instruction. This should


typically be done within a conditional statement, as shown in the
example below.

CRBasic Example 9-1. Restarting the CR300 Under Program Control

Public RestartProg As Boolean


Public PTemp
Public Batt_volt

'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

Analog-to-digital conversion. The process that translates analog voltage levels


to digital values.

Com1

When configured as a communication port, terminals C1 and C2 act as a pair


to form Com1.

Communication Verification Interval (CVI)

The interval at which a PakBus device verifies the accessibility of neighbors in


its neighbor list.

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.

Datalogger support software

This is PC200W, PC400, and LoggerNet.

Device Configuration Utility

A utility included with datalogger support software. It is also available on the


ResourceDVD and at www.campbellsci.com/downloads. The CR300 is
compatible with version 2.12 and newer.

58
CR300-Series Datalogger

File Control

A feature of PC200W, PC400, LoggerNet, and Device Configuration Utility. It


provides a view of the CR300 file system and a menu of file management
commands.

Operating System (OS)

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.

Connect an Ethernet cable to the


10/100 Ethernet port.

Connect the USB cable from a USB


port on the computer to the USB
port on the datalogger. The USB
connection also provides power to
the datalogger.

In about a minute or less, you


should see activity on the yellow
and green Ethernet port LEDs. If
you do not, contact your network
administrator.

Connect to the CR300 through


Device Configuration Utility.

A-1
Appendix A. CR310 Ethernet Communication QuickStart

In the Deployment tab, select the


Ethernet subtab.

In the Ethernet Power options,


select 1 Minute or Always On,
depending on your application.
Refer to the description at the
bottom of the Device Configuration
window for information on these
options.

Enter the IP Address, Subnet


Mask, and IP Gateway. These
values should be provided by your
network administrator. A static IP
address is recommended.

Alternatively, note the IP address


assigned to the datalogger via
DHCP. When the IP Address is set
to 0.0.0.0, the default, the
information displayed on the right
side of the window updates with the
information obtained from the
DHCP server. Note, however, that
this address is not static and may
change. An IP address here of
169.254.###.### means the
datalogger was not able to obtain an
address from the DHCP server.
Contact your network administrator
for help.

Click Apply to save the changes.

A-2
Appendix A. CR310 Ethernet Communication QuickStart

A.2 Set Up LoggerNet or PC400 software


NOTE PC200W does not allow IP connections.

Watch the video for this section: EZSetup Ethernet Connection.

PC400: Click the Add Datalogger


button (shown on the right).

LoggerNet:

1) From the LoggerNet toolbar,


click Main | Setup.
2) Click View and select EZ
(Simplified) View.
3) Click the Add Datalogger
button (shown on the right).

This opens the EZSetup Wizard.


Click Next.

Select the CR300Series in the


Datalogger Type and Name list.

Give the CR310 a name, such as a


site or project name, to identify it
within your software.

Click Next.

In the list of communication modes,


select IP Port.

Click Next.

A-3
Appendix A. CR310 Ethernet Communication QuickStart

Enter the datalogger IP address and


port number in the Internet IP
Address field. The default
datalogger port number is 67851.
The IP address and port number are
entered together, separated by a
colon.

Leading 0s within the address must


be omitted.

IPv4 example: 192.168.1.2:6785


An IPv6 address must be enclosed
in square brackets, for example
[2001:db8::1234:5678]:6785.

Click Next.
1 The datalogger port number can be
changed in Device Configuration Utility
in the Network Services subtab.

Enter the PakBus Address. This


must match the hardware settings of
your CR310. The default PakBus
Address is 1.

Click Next.

The CR310 does not use a security


code or a PakBus encryption key by
default, so the Security Code can be
kept at 0 and the PakBus
Encryption Key can be left blank.
If either setting has been changed,
enter the new code or key. Security
can be set through Device
Configuration Utility, Connect
Screen Settings Editor, or the
SetSecurity() CRBasic instruction.

Click Next.

A-4
Appendix A. CR310 Ethernet Communication QuickStart

Review the software settings in the


Communication Setup Summary.

Click Next.

With the USB cable connected, test


the communication settings by
selecting Yes. Click Next to initiate
the test. To troubleshoot an
unsuccessful test, see Section 9,
Troubleshooting (p. 53). Click Next
again after a successful test.

Click through the remaining steps and adjust settings where needed for your setup.

Click Finish to complete the


EZSetup Wizard and go to the Setup
Screen. A summary of the settings
entered is shown.

A-5
Appendix A. CR310 Ethernet Communication QuickStart

A.3 Ethernet LED Indicators


When the CR310 is powered, the two LEDs on the 10/100 Ethernet port will
turn on according to Ethernet activity. See TABLE A-1:

TABLE A-1. Ethernet Port LED Activity

LED State Meaning


Solid Valid Ethernet link
Yellow Off Invalid Ethernet link
Flashing Ethernet activity
Solid 100 Mbps link
Green
Off 10 Mbps link

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 The radio options cannot be mixed within a network. A CR300-


or CR310-RF407 can only be used with other CR300- or CR310-
RF407s and standalone RF407s. A CR300- or CR310-RF412 can
only be used with other CR300- or CR310-RF412s and standalone
RF412s. A CR300- or CR310-RF422 can only be used with other
CR300- or CR310-RF422s and standalone RF422s.

These dataloggers are designed for license-free use in several countries:

The RF407 option has a 902 to 928 MHz operating-frequency range


appropriate for use in the United States and Canada (FCC / IC
compliant).

The RF412 option has a 915 to 928 MHz operating-frequency range


appropriate for use in Australia and New Zealand (ACMA compliant).

The RF422 option has an 863 to 873 MHz operating-frequency range


appropriate for use in most of Europe and some of Asia (ETSI
compliant).

A CR300-RF407 can be used with an RF407 at a base computer to establish


communication between datalogger support software and the CR300-RF407. A
CR300-RF407 can also be part of a new or existing RF407 network.

NOTE These procedures assume the RF407 and the CR300-RF407 are at
their factory default settings.

A CR300-RF407 contains the same radio as a standalone RF407. Most of the


radio settings are the same for the CR300-RF407 and the RF407. See the
RF407-Series Spread Spectrum Radios manual for more information on
specifications and radio communication using the CR300-RF407.

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 Example 1: Computer with RF407 to CR300-


RF407
These steps walk through creating the most basic setup of a radio at a computer
communicating to one datalogger.

B.2.1 Configure the Base Radio

Open Device Configuration Utility.

Follow the Device Configuration


Utility Connect Instructions to
connect to the RF407 over USB. If
the USB driver is not installed
already, click Install the USB
device driver and follow the
instructions in the Device Driver
Installation Wizard.

B-2
Appendix B. RF407, RF412, and RF422 Communication QuickStart

In Device Configuration Utility,


click next to the
Communication Port box. Select
the port named RF407-Series.

Click Ok.

Click Connect.

In the Main tab, set the Active


Interface to USB or RS-232
depending on how your computer
will be connected to the RF407.

Click Apply.

The Confirm Settings Apply dialog


box appears.

Click Yes.

The TX/PWR and RX LEDs flash


once, after which the TX/PWR
LED returns to blinking at the
Power Mode interval (0.5 sec, by
default).

B-3
Appendix B. RF407, RF412, and RF422 Communication QuickStart

The settings changes have been


saved dialog box appears.

Click OK.

Device Configuration Utility


disconnects from the RF407.

B.2.2 Install the Radio

If not already connected, connect


the RF407 to the communication
port on your computer that was
selected as the active interface.

Attach an antenna to the RF407.

B-4
Appendix B. RF407, RF412, and RF422 Communication QuickStart

If not connecting over USB, provide


power to the RF407 through the DC
Power jack. (A USB connection
supplies enough power for normal
operation.)

B.2.3 Install the Datalogger

Attach an antenna to the


CR300-RF407.

Apply power to the CR300-RF407


by either connecting 12 Vdc at the
BAT+ terminals or connecting 16
to 32 Vdc at the CHG+ terminals.

B-5
Appendix B. RF407, RF412, and RF422 Communication QuickStart

B.2.4 Set Up PC200W, PC400, or LoggerNet Software


PC200W or PC400: Click the Add
Datalogger button (shown on the
right).

LoggerNet:

1) From the LoggerNet toolbar,


click Main | Setup.
2) Click View and select EZ
(Simplified) View.
3) Click the Add Datalogger
button (shown on the right).

This opens the EZSetup Wizard.


Click Next.

Select the CR300Series in the


Datalogger Type and Name list.

Give the datalogger a name, such as


a site or project name, to identify it
within your software.

Click Next.

In the list of communication modes,


select Direct Connect.

Click Next.

In the COM Port list, select the port


titled RF407-Series.

(Note that you choose RF407-


Series to select the USB port to
which the RF407 is attached.
LoggerNet sees the CR300-RF407
as directly connected to this port.
The RF407-to-datalogger link does
not need to be indicated in
LoggerNet.)

Click Next.

B-6
Appendix B. RF407, RF412, and RF422 Communication QuickStart

Enter the PakBus Address of the


datalogger. This must match the
hardware settings of your CR300.
The default PakBus Address is 1.

Click Next.

The CR300 does not use a security


code or a PakBus encryption key by
default, so the Security Code can be
set to 0 and the PakBus Encryption
Key can be left blank. If either
setting has been changed, enter the
new code or key. Security can be set
through Device Configuration
Utility, Connect Screen Settings
Editor, or the SetSecurity()
CRBasic instruction.

Click Next.

Review the software settings in the


Communication Setup Summary.

Click Next.

B-7
Appendix B. RF407, RF412, and RF422 Communication QuickStart

Test the communication settings by


selecting Yes. Click Next to initiate
the test. To troubleshoot an
unsuccessful test, see Section 9,
Troubleshooting (p. 53). Click Next
again after a successful test.

Optional: Click through the remaining steps and adjust settings where needed for your setup.

Click Finish to complete the


EZSetup Wizard and go to the Setup
Screen. A summary of the settings
entered is shown.

B.3 Example 2: Computer with RF407 to Multiple


CR300-RF407s
These steps show how to create a network of multiple dataloggers
communicating through a radio at a computer. To begin, follow the steps
shown in Example 1 Appendix B.2.1, Configure the Base Radio (p. B-2), and
Appendix B.2.2, Install the Radio (p. B-4). Then, follow the steps in the sections
below.

B-8
Appendix B. RF407, RF412, and RF422 Communication QuickStart

B.3.1 Set Unique Datalogger PakBus Addresses


With multiple CR300-RF407s, each CR300-RF407 requires a unique PakBus
address. The PakBus address is set in the CR300 through Device Configuration
Utility.

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.

Connect to the CR300 in Device


Configuration Utility.

In the Datalogger tab within the


Deployment tab, enter the PakBus
Address.

Click Apply.

B.3.2 Install the Dataloggers


For each datalogger in the network, follow the steps shown in Example 1
Appendix B.2.3, Install the Datalogger (p. B-5).

B-9
Appendix B. RF407, RF412, and RF422 Communication QuickStart

B.3.3 Set Up PC200W, PC400, or LoggerNet Software

For each datalogger in the network,


follow the steps shown in Example
1 Appendix B.2.4, Set Up
PC200W, PC400, or LoggerNet
Software (p. B-6). Give each
datalogger a unique name and use
the PakBus address assigned
through Device Configuration
Utility. This ensures that the
software settings (PC200W, PC400,
or LoggerNet) match the hardware
settings set through Device
Configuration Utility.

The main screen of PC200W and


PC400, and the Setup screen of
LoggerNet show the resulting
network.

B.4 Example 3 (LoggerNet Only): Using a CR300-


RF407 as a Router
The previous procedures can be extended to use one CR300-RF407 as a router
in the network. This is useful for communicating around an obstacle, such as a
hill or building, or to reach longer distances.

To begin, follow the steps shown in Example 1 Appendix B.2.1, Configure


the Base Radio (p. B-2), and Appendix B.2.2, Install the Radio (p. B-4). Then, give
each datalogger a unique PakBus address, as shown in Example 2 Appendix
B.3.1, Set Unique Datalogger PakBus Addresses (p. B-9). The datalogger that
will act as a router needs additional configuration.

B.4.1 Configure the Router

Use Device Configuration Utility to


connect to the CR300-RF407 that
will be used as a router.

B-10
Appendix B. RF407, RF412, and RF422 Communication QuickStart

On the Deployment | Com Ports


Settings tab, in the Select the
ComPort list, select COMRF.

Set the Beacon Interval to 60


seconds (or the amount of time you
are willing to wait for the leaf
dataloggers in the network to be
discovered).

Set the Verify Interval to


something slightly greater than the
expected communication interval
between the router and the other
(leaf) dataloggers in the network.
For example, the following
screenshot shows the Verify
Interval set to 90 seconds.

In the Advanced tab, set Is Router


to True.

Click Apply.

B.4.2 Install the Dataloggers


Attach an antenna and apply power to each datalogger in the network as shown
in Example 1 Appendix B.2.3, Install the Datalogger (p. B-5).

B.4.3 Add Routing Datalogger to LoggerNet Network

Open LoggerNet Setup.

On the View menu, click Standard.

B-11
Appendix B. RF407, RF412, and RF422 Communication QuickStart

Click Add Root. The Add window


opens.

Select ComPort.

Select PakBusPort (PakBus


Loggers).

Select CR300Series.
Click Close.

B-12
Appendix B. RF407, RF412, and RF422 Communication QuickStart

Select ComPort in the Entire


Network pane.

In the ComPort Connection list in


the Standard section on the right,
select the port titled RF407-Series.

Select PakBusPort in the Entire


Network pane.

Select the PakBus Port Always


Open check box. If you wish to
prevent the possibility of LoggerNet
communicating with any other
dataloggers in the network without
going through the router CR300-
RF407, set the Beacon Interval to
00 h 00 m 00s.

B-13
Appendix B. RF407, RF412, and RF422 Communication QuickStart

Select CR300Series in the Entire


Network pane.

Set the PakBus Address to the


address that was assigned to the
router datalogger in Device
Configuration Utility.

Click Rename.

Enter a descriptive name for the


datalogger.

B.4.4 Add Leaf Dataloggers to LoggerNet Network

In LoggerNet Setup, right-click on


the router CR300-RF407 in the
Entire Network pane and click
CR300Series.

B-14
Appendix B. RF407, RF412, and RF422 Communication QuickStart

With the newly added datalogger


selected in the Entire Network pane,
set the PakBus Address to the
address that was assigned to the leaf
datalogger in Device Configuration
Utility.

Click Rename.

Enter a descriptive name for the


datalogger.

Repeat for all other leaf dataloggers


in the network

Click Apply to save the LoggerNet


network changes.

B.5 Communication Combinations


The CR300-RF407 can be used in a system with multiple communication
methods. For example, in the figure below, the router CR300-RF407
communicates with LoggerNet through an RV50 cellular modem connected to
the CR300-RF407 using an RS-232 data cable. The router CR300-RF407
communicates with the leaf CRX-RF407s through RF.

B-15
Appendix B. RF407, RF412, and RF422 Communication QuickStart

The RF portion of this network requires no changes to the hardware settings


described in Example 3 Appendix B.4, Example 3 (LoggerNet Only): Using a
CR300-RF407 as a Router (p. B-10). See the manual for the communication
product being used in combination with the CR300-RF407 (in this example,
the RV50) for information on setting up LoggerNet to communicate with the
router CR300-RF407.

B.6 Network Planner


For more complicated networks, LoggerNet Network Planner is recommended
for the network setup. Select devices from the Device Palette and place them
on the drawing canvas. Use the Link Tool to draw lines indicating the
communication links between devices. Use the Activity Tool to indicate
activities that will take place between devices.

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.

Refer to the Network Planner help for more information.

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.2 Example 1: Create a Network


Using this setup, a CR300-WIFI hosts a Wi-Fi network that other Wi-Fi
devices can join.

C.2.1 Configure the Datalogger


The CR300-WIFI defaults to this mode of Wi-Fi communication. However, if
the settings have been changed, follow the steps below:

Attach an antenna to the CR300-


WIFI.

Apply power to the CR300-WIFI by


either connecting 12 Vdc at the
BAT+ terminals or connecting 16
to 32 Vdc at the CHG+ terminals.

C-1
Appendix C. WIFI Communication QuickStart

Connect to the CR300-WIFI in


Device Configuration Utility.

In the Deployment | Wi-Fi tab, in


the Configuration list, select
Create a Network.

Click Apply to save your changes.

C.2.2 Configure the Computer

In your computer settings, open


Network & Internet settings.

C-2
Appendix C. WIFI Communication QuickStart

In the Wi-Fi settings, select the Wi-


Fi network hosted by the CR300-
WIFI. The default network name is
CR300_ followed by the serial
number of the datalogger. In this
example, the Wi-Fi network is
named CR300_136.

Click Connect.

C.2.3 Set Up LoggerNet or PC400 Software


NOTE PC200W does not allow IP connections.

PC400: Click the Add Datalogger


button (shown on the right).

LoggerNet:

1) From the LoggerNet toolbar,


click Main | Setup.
2) Click View and select EZ
(Simplified) View.
3) Click the Add Datalogger
button (shown on the right).

This opens the EZSetup Wizard.


Click Next.

C-3
Appendix C. WIFI Communication QuickStart

Select CR300Series in the


Datalogger Type and Name list.

Give the datalogger a name, such as


a site or project name, to identify it
within your software.

Click Next.

In the list of communication modes,


select IP Port.

Click Next.

In the Internet IP Address field,


enter 192.168.67.1. This is the
default IP address when the CR300-
WIFI creates the network.

Click Next.

Enter the PakBus Address. This


must match the hardware settings of
your CR300-WIFI. The default
PakBus Address is 1.

Click Next.

C-4
Appendix C. WIFI Communication QuickStart

The CR300-WIFI does not use a


security code or a PakBus
encryption key by default, so the
Security Code can be set to 0 and
the PakBus Encryption Key can be
left blank. If either setting has been
changed, enter the new code or key.
Security can be set through Device
Configuration Utility, Connect
Screen Settings Editor, or the
SetSecurity() CRBasic instruction.

Click Next.

Review the software settings in the


Communication Setup Summary.

Click Next.

Test the communication settings by


selecting Yes. Click Next to initiate
the test. To troubleshoot an
unsuccessful test, see Section 9,
Troubleshooting (p. 53). Click Next
again after a successful test.

Click through the remaining steps and adjust settings where needed for your setup.

C-5
Appendix C. WIFI Communication QuickStart

Click Finish to complete the


EZSetup Wizard and go to the Setup
Screen. A summary of the settings
entered is shown.

C.2.4 Recommended: Set Network Security


Campbell Scientific recommends setting security on the network to prevent
unauthorized access.

C.2.4.1 Modify Datalogger Settings

Connect to the CR300-WIFI


through Device Configuration
Utility.

C-6
Appendix C. WIFI Communication QuickStart

In the Deployment | Wi-Fi tab,


enter a Password.

Click Apply.

C.2.4.2 Modify Computer Settings

In your computer settings, open the


Network & Internet settings.

C-7
Appendix C. WIFI Communication QuickStart

In the Wi-Fi settings, select the Wi-


Fi network hosted by the CR300-
WIFI. Notice that the network is
now labeled as Secured.

Click Connect.

C.3 Example 2: Join a Network


These steps show how to connect a CR300-WIFI to an existing Wi-Fi network
and communicate through LoggerNet or PC400.

C.3.1 Configure the Datalogger

Attach an antenna to the CR300-


WIFI.

C-8
Appendix C. WIFI Communication QuickStart

Apply power to the CR300-WIFI by


either connecting 12 Vdc at the
BAT+ terminals or connecting 16
to 32 Vdc at the CHG+ terminals.

Connect to the CR300-WIFI


through Device Configuration
Utility.

In the Deployment | Wi-Fi tab, in


the Configuration list, select Join a
Network.

C-9
Appendix C. WIFI Communication QuickStart

To see which networks are


available, click next to the
Network Name (SSID) field. This
displays a dialog box showing all
available wireless networks. Select
the network you wish to connect to
and click OK.

If this is a secured network, enter


the password in the Password field,
and enter any additional security in
the Enterprise section of the
window.

Enter the IP Address, Network


Mask, and Gateway. These values
should be provided by your network
administrator. A static IP address is
recommended.

Alternatively, you can use an IP


address assigned to the datalogger
via DHCP. To do this, make sure the
IP Address is set to 0.0.0.0. Click
Apply to save the configuration
changes. Then reconnect. The IP
information obtained through DHCP
is updated and displayed in the
Status section of the Wi-Fi subtab.
Note, however, that this address is
not static and may change. An IP
address here of 169.254.###.###
means the datalogger was not able
to obtain an address from the DHCP
server. Contact your network
administrator for help.

C-10
Appendix C. WIFI Communication QuickStart

Click Apply to save your changes.

C.3.2 Set Up LoggerNet or PC400 Software


Follow the steps shown in Example 1 Configure LoggerNet or PC400
Software. For the IP address, enter the address used when configuring the
datalogger. In this example, the IP address was 192.168.1.2.

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:

1. Create the Short Cut program following the procedure in Section 4,


QuickStart (p. 2). Finish the program and exit Short Cut. Make note of the
file name used when saving the Short Cut program.

2. Open 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.

4. Immediately save the file in a folder different from


C:\Campbellsci\SCWin, or save the file with a different file name.

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.

6. Import wiring information to the program by opening the associated .DEF


file. Copy and paste the section beginning with heading -Wiring for
CR300 Series- into the CRBasic program, usually at the head of the file.
After pasting, edit the information such that an apostrophe (') begins each
line. This character instructs the datalogger compiler to ignore the line
when compiling.

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.

TABLE E-1. CRBasic Program Structure

Declare constants List fixed constants using Const.


List, and if necessary, dimension
Declare Public variables variables viewable during program
execution.
List, and if necessary, dimension
Declare Dim variables variables not viewable during program
execution.
Declarations

Define aliases Assign aliases to variables using Alias.


Assign engineering units to variable
(optional). Units are strictly for
Define units
documentation. The CR300 makes no use
of units nor checks unit accuracy.
DataTable() defines stored data tables.
Define data tables
The CR300 can save up to 20 data tables.
List data to be stored in the data table, for
Processing of data example, Sample(), Average(),
Maximum(), Minimum().
BeginProg defines the beginning of
Begin program
statements defining CR300 actions.
Scan sets the interval for a series of
Begin scan
measurements.
Measurements Enter measurements to make.
Processing of data Enter any additional processing.
Scan Loop

Declared data tables must be called using


Call data table(s)
CallTable to process and store data.
Check measurements and initiate controls
Initiate controls
if necessary.
NextScan loops back to the beginning of
Next scan
the scan and waits for the next scan.
EndProg defines the end of statements
End program
defining CR300 actions.

E-1
Appendix E. Introduction to CRBasic Programming

CRBasic Example E-1. CRBasic Program Structure

'Declarations

'Define Constants
Const RevDiff = 1
Const Del = 0 'default
Declare constants
Const Integ = 400
Const Mult = 1
Const Offset = 0

'Define public variables


Public RefTemp
Public TC(6)
Declare public variables,
dimension array, and declare Declarations
'Define Units units.
Units RefTemp = Deg C
Units TC = Deg C

'Define data tables


DataTable(Temp,1,2000)
DataInterval(0,10,min,10)
Define data table
Average(1,RefTemp,FP2,0)
Average(6,TC(),FP2,0)
EndTable

'Begin Program
BeginProg

'Set scan interval


Scan(1,Sec,3,0)

'Measurements
Measure
PanelTemp(RefTemp,400)
TCDiff(TC()...Offset)

'Processing (None in this


'example)
Scan loop

'Call data table


Call data table
CallTable Temp

'Controls
PortSet(...)

'Loop to next scan


NextScan

'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.

CRBasic Example E-2. Inserting Comments

'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.

'Declaration of variables starts here.


Public Start(6) 'Declare the start time array

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.

Variable names can be up to 39 characters in length, but most variables should


be no more than 35 characters long. This allows for four additional characters
that are added as a suffix to the variable name when it is output to a data table.
Variable names can contain the following characters:
A to Z
a to z
0 to 9
_ (underscore)
$

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.

Several variables can be declared on a single line, separated by commas:

Public RefTemp, AirTemp2, Batt_Volt

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:

Public SetTemp = {35}


Public Array(3) = {1,2,3}
Public Str as String = "Hello"
Public Bool as Boolean = TRUE

E-3
Appendix E. Introduction to CRBasic Programming

E.2.1 Declaring Data Types


Variables and data values stored in final memory can be configured with
various data types to optimize program execution and memory usage.

The declaration of variables with the Public or Dim instruction allows an


optional type descriptor As that specifies the data type. The default data type
(declaration without a descriptor) is IEEE4 floating point, which is equivalent
to the As Float declaration. Variable data types are listed in TABLE E-2.
CRBasic Example E-3 shows various data types in use in the declarations and
output sections of a program.

TABLE E-2. Data Types in Variable Memory

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

TABLE E-2. Data Types in Variable Memory

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.

CRBasic Example E-3. Variable Data Type Declarations

'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.

'Float Variable Examples


Public Z
Public X As Float

'Long Variable Example


Public CR300Time As Long
Public PosCounter As Long
Public PosNegCounter As Long

'Boolean Variable Examples


Public Switches(8) As Boolean
Public FLAGS(16) As Boolean

'String Variable Example


Public FirstName As String * 16 'allows a string up to 16 characters long

BeginProg
'Program logic goes here
EndProg

E.2.2 Declaring Arrays


Multiple variables of the same root name may be declared. The resulting series
of like-named variables is called an array. An array is created by placing a
suffix of (X) on the variable name. X number of variables are created that
differ in name only by the incrementing number in the suffix. For example, the
four statements

E-5
Appendix E. Introduction to CRBasic Programming

Public TempC1
Public TempC2
Public TempC3
Public TempC4

can simply be condensed to

Public TempC(4).

This statement creates in memory the four variables TempC(1), TempC(2),


TempC(3), and 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

Public StringVar(5) As String * 36

This statement creates in memory the five variables StringVar(1),


StringVar(2), StringVar(3), StringVar(4), and StringVar(5).

A variable array is useful in program operations that affect many variables in


the same way. CRBasic Example E-4 shows compact code that converts four
temperatures (C) to F.

In this example, a For/Next structure with an incrementing variable is used to


specify which elements of the array will have the logical operation applied to
them. The CRBasic For/Next function will only operate on array elements that
are clearly specified and ignore the rest.

CRBasic Example E-4. Using a Variable Array in Calculations

'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.2.3 Conserving Program Memory


One or more of the following memory-saving techniques can be used on the
rare occasions when a program reaches memory limits:

E-6
Appendix E. Introduction to CRBasic Programming

Declare variables as DIM instead of Public. DIM variables do not


require buffer memory for data retrieval.
Reduce arrays to the minimum size needed. Arrays save memory over
the use of scalars as there is less metadata required per value.
Use variable arrays with aliases instead of individual variables with
unique names. Aliases consume less memory than unique variable
names.
Confine string concatenation to DIM variables.
Dimension string variables only to the size required.

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:

Const CtoF_Mult = 1.8

E.4 Preserving Variables through User Settings


When a program compiles, all variables are initialized. A program is
recompiled after a power failure or a manual stop. For instances that require
variables to be preserved through a program recompile, the CR300 has User
Settings. Entries in User Settings are not erased when a program is recompiled.

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.

CRBasic Example E-5. Using SetSettings to Preserve Variables

'This program example increments a counter every second.


'If for any reason the counter is reinitialized to 0,
'it is set to the value stored in the UserVal() array in User Settings.

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

E.5 Data Tables


Data are stored in tables as directed by the CRBasic program. A data table is
created by a series of CRBasic instructions entered after variable declarations
but before the BeginProg instruction. These instructions include:

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.

CRBasic Example E-6. Definition and Use of a Data Table

'This program example demonstrates definition and use of data tables.

'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

'Define Data Tables


DataTable(OneMin,True,-1) 'Required beginning of data table declaration
DataInterval(0,1,Min,10) 'Optional instruction to trigger table at one-minute interval
Average(1,BattV,FP2,False)'Optional instruction to average variable BattV
Average(1,PTemp_C,FP2,False) 'Optional instruction to average variable PTemp_C
Average(1,Temp_C,FP2,False) 'Optional instruction to average variable Temp_C
EndTable 'Required end of data table declaration

'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.

DataTable() instruction and parameters are as follows:

DataTable(Name, TrigVar, Size)

Name The table name can be any combination of numbers, letters,


and underscore up to 20 characters in length. The first character must
be a letter or underscore.

TrigVar Controls whether or not data records are written to


storage. Data records are written to storage if TrigVar is true and if
other conditions, such as DataInterval(), are met. Default setting is
1 (True). TrigVar may be a variable, expression, or constant.
TrigVar does not control intermediate data processing. Intermediate
data processing is controlled by the disable variable, DisableVar,
which is a parameter in all output processing instructions.

Size Table size is the number of records to store in a table before


new data begins overwriting old data. If 10 is entered, 10 records are
stored in the table; the eleventh record will overwrite the first record.
If 1 is entered, memory for the table is allocated automatically at the
time the program compiles. Automatic allocation is preferred in most
applications since the CR300 sizes all tables such that they fill (and
begin overwriting the oldest data) at about the same time.

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.5.1 Data Output-Processing Instructions


Data-storage processing instructions, also known as output processing
instructions, determine what data are stored in a data table. When a data table is
called in the CRBasic program, data-storage processing instructions process
variables holding current inputs or calculations. If trigger conditions are true,
for example if the data-output interval has expired, processed values are stored
into the data table. In CRBasic Example E-6, Definition and Use of a Data
Table (p. E-8), three averages are stored.

Consider the Average() instruction as an example data-storage processing


instruction. Average() stores the average of a variable over the data-output
interval. Its parameters are:

E-9
Appendix E. Introduction to CRBasic Programming

Reps number of sequential elements in the variable for which


averages are calculated. Reps is set to 1 to average PTemp, and set to
2 to average two thermocouple temperatures, both of which reside in
the variable array Temp_C() (a variable array of 2).
Source variable to average. Variables PTemp_C and Temp_C() (a
variable array of 2) are used.
DataType Data type for the stored average (the example uses data
type FP2). Final-data memory data types are listed in TABLE E-3.
DisableVar controls whether a measurement or value is included in
an output processing function. A measurement or value is not included
if DisableVar is true ( 0). For example, if the disable variable in an
Average() instruction is True, the current value will not be included
in the average.CRBasic Example E-7 shows how DisableVar can be
used to exclude values from an averaging process. In this example,
DisableVar is controlled by Flag1. When Flag1 is true, DisableVar is
true. When it is false, DisableVar is false. When False is entered as
the argument for DisableVar, all readings are included in the average.
The average of variable Oscillator does not include samples occurring
when Flag1 is true, which results in an average of 2; when Flag1 is
false (all samples used), the average is 1.5.

TABLE E-3. Data Types in Final Data Memory

Word Size
Name Argument Description Notes Range Resolution
(Bytes)

Minimum Maximum Absolute Decimal


Default final-memory Value Location
Campbell data type. Use FP2 for 0.001 7999.
0 7.999 X.XXX
Scientific 2- stored data requiring 3
FP2 FP2 byte floating 2 or 4 significant digits. If 8 79.99 XX.XX
point more significant digits
number are needed, use IEEE4 80 799.9 XXX.X
or an offset. 800 7999. XXXX.

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

TABLE E-3. Data Types in Final Data Memory

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

TABLE E-3. Data Types in Final Data Memory

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

CRBasic Example E-7. Use of the Disable Variable

'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.

'Declare Variables and Units


Public Oscillator As Long
Public Flag(1) As Boolean
Public DisableVar As Boolean

'Define Data Tables


DataTable(OscAvgData,True,-1)
DataInterval(0,1,Min,10)
Average(1,Oscillator,FP2,DisableVar)
EndTable

'Main Program
BeginProg
Scan(1,Sec,1,0)

'Reset and Increment Counter


If Oscillator = 2 Then Oscillator = 0
Oscillator = Oscillator + 1

'Process and Control


If Oscillator = 1
If Flag(1) = True Then
DisableVar = True
EndIf
Else
DisableVar = False
EndIf

'Call Data Tables and Store Data


CallTable(OscAvgData)

NextScan
EndProg

E.6 BeginProg / EndProg


BeginProg defines the beginning of statements defining CR300 actions. Any
instructions between BeginProg and Scan() are only executed when the
datalogger first runs the program. EndProg marks the end of the program.

E.7 Scan() / NextScan


Simple CR300 programs are often built entirely within a single Scan() /
NextScan structure, with only variable and data table declarations outside the
scan. Scan() / NextScan creates an infinite loop. Each periodic pass through
the loop is synchronized to the CR300 clock. Scan() determines how
frequently instructions in the program are executed, as shown in the following
CRBasic code snip:

E-13
Appendix E. Introduction to CRBasic Programming

'Scan(Interval, Units, BufferSize, Count)


Scan(1,Sec,1,0)
'CRBasic instructions go here
ExitScan

Scan() has four parameters:


Interval the interval between scans. Interval is 1 ms Interval 1
day.
Units the time unit for the interval.
BufferSize not used in the CR300, but left in for compatibility
reasons. The CR300 does not support pipeline mode.
Count number of scans to make before proceeding to the
instruction following NextScan. A count of 0 means to continue
looping forever (or until ExitScan).

E.8 Programming Instructions


Common instructions (called "commands" in BASIC) and operators used in
most BASIC languages, including program control statements and logic and
mathematical operators, can also be used in CRBasic.

In addition to BASIC syntax, instructions are included in CRBasic to facilitate


measurement and control and to store data. CRBasic Editor Help contains a
comprehensive list of these instructions. Measurement instructions set up
CR300 hardware to make measurements and store results in variables. Control
instructions set up CR300 hardware to provide outputs depending on triggers.
Data storage instructions process measurements into averages, maxima,
minima, standard deviation, etc.

Each instruction is a keyword followed by a series of informational parameters


needed to complete the procedure. For example, the instruction for measuring
CR300 processing board temperature is:

PanelTemp(Dest,fN1)

PanelTemp is the instruction name. Two parameters follow: Dest, a


destination variable name in which the temperature value is stored; and fN1, the
notch frequency to use. To place the processing board temperature
measurement in the variable RefTemp, filtering out 60 Hz noise, the syntax is
as shown in CRBasic Example E-8.

CRBasic Example E-8. Measurement Instruction Syntax

'This program example demonstrates the use of a single measurement instruction. In this
'case, the program measures the temperature of the CR300 processing board.

Public RefTemp 'Declare variable to receive instruction

BeginProg
Scan(1,Sec,3,0)
PanelTemp(RefTemp,60) 'Instruction to make measurement
NextScan
EndProg

E-14
Appendix E. Introduction to CRBasic Programming

E.8.1 Argument Types


Most CRBasic commands or instructions, have subcommands or parameters.
Parameters are populated by the programmer with arguments. Many
instructions have parameters that allow different types of arguments. Common
argument types are listed below. Allowed argument types are specifically
identified in the description of each instruction in CRBasic Editor Help.
Constant
Variable
Array
Expression
Name or list of Names

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:

TempF = TempC * 1.8 + 32

Logical expressions are used to indicate absence or presence of an event. For


example, a relative humidity measurement of 100% indicates a condensation
event such as fog, rain, or dew. The CR300 can render the state of the event
into binary form for further processing, so the event is either occurring (true),
or the event has not occurred (false).

In all cases, 0 is translated as False in logical expressions; by extension, any


non-zero number is considered "non-False." However, True is predefined in
the CR300 operating system to equal 1, so only 1 is always translated as
True. Consider the expression

If Condition = TRUE Then...

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...

Since = True is omitted from the expression, Condition is considered true if it


equals any non-zero value.

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

E.9.1 Expressions in Arguments


Many CRBasic instruction parameters allow the entry of arguments as
expressions. If an expression is a comparison using logical operators, it will
return 1 if true and 0 if false. The following code snippet shows the use of an
expression as an argument in the TrigVar parameter of the DataTable()
instruction:

'DataTable(Name, TrigVar, Size)


DataTable(Temp, TC > 100, 5000)

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, Inc. Campbell Scientific Canada Corp.


815 West 1800 North 14532 131 Avenue NW
Logan, Utah 84321 Edmonton AB T5L 4X4
UNITED STATES CANADA
www.campbellsci.com info@campbellsci.com www.campbellsci.ca dataloggers@campbellsci.ca

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

Campbell Scientific Southeast Asia Co., Ltd. Campbell Scientific Ltd.


877/22 Nirvana@Work, Rama 9 Road Campbell Park
Suan Luang Subdistrict, Suan Luang District 80 Hathern Road
Bangkok 10250 Shepshed, Loughborough LE12 9GX
THAILAND UNITED KINGDOM
www.campbellsci.asia info@campbellsci.asia www.campbellsci.co.uk sales@campbellsci.co.uk

Campbell Scientific Australia Pty. Ltd. Campbell Scientific Ltd.


PO Box 8108 3 Avenue de la Division Leclerc
Garbutt Post Shop QLD 4814 92160 ANTONY
AUSTRALIA FRANCE
www.campbellsci.com.au info@campbellsci.com.au www.campbellsci.fr info@campbellsci.fr

Campbell Scientific (Beijing) Co., Ltd. Campbell Scientific Ltd.


8B16, Floor 8 Tower B, Hanwei Plaza Fahrenheitstrae 13
7 Guanghua Road 28359 Bremen
Chaoyang, Beijing 100004 GERMANY
P.R. CHINA www.campbellsci.de info@campbellsci.de
www.campbellsci.com info@campbellsci.com.cn

Campbell Scientific Spain, S. L.


Campbell Scientific do Brasil Ltda. Avda. Pompeu Fabra 7-9, local 1
Rua Apinags, nbr. 2018 Perdizes 08024 Barcelona
CEP: 01258-00 So Paulo SP SPAIN
BRASIL www.campbellsci.es info@campbellsci.es
www.campbellsci.com.br vendas@campbellsci.com.br

Please visit www.campbellsci.com to obtain contact information for your local US or international representative.

Das könnte Ihnen auch gefallen