Campbell Scientific CR200, CR200X User Manual

OPERATOR’S MANUAL
CR200/CR200X Series
Dataloggers
Revision: 1/14

Warranty

“PRODUCTS MANUFACTURED BY CAMPBELL SCIENTIFIC, INC. are warranted by Campbell Scientific, Inc. (“Campbell”) to be free from defects in materials and workmanship under normal use and service for twelve (12) months from date of shipment unless otherwise specified in the corresponding Campbell pricelist or product manual. Products not manufactured, but that are re-sold by Campbell, are warranted only to the limits extended by the original manufacturer. Batteries, fine-wire thermocouples, desiccant, and other consumables have no warranty. Campbell’s obligation under this warranty is limited to repairing or replacing (at Campbell’s option) defective products, which shall be the sole and exclusive remedy under this warranty. The customer shall assume all costs of removing, reinstalling, and shipping defective products to Campbell. Campbell will return such products by surface carrier prepaid within the continental United States of America. To all other locations, Campbell will return such products best way CIP (Port of Entry) INCOTERM® 2010, prepaid. 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 Campbell such as programming to customer specifications, electrical connections to products manufactured by Campbell, and product specific training, is part of Campbell’s product warranty. CAMPBELL EXPRESSLY DISCLAIMS AND EXCLUDES ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Campbell is not liable for any special, indirect, incidental, and/or consequential damages.”

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. After an application engineer determines the nature of the problem, an RMA number will be issued. Please write this number clearly on the outside of the shipping container. Campbell Scientific’s 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 web site 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 customer’s 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.

Table of Contents

Section 1. Introduction ............................................... 1
1.1 CR200(X) series Datalogger Models ..................................................................... 1
Section 2. Quickstart Tutorial .................................... 3
2.1 Primer - CR200(X) Data Acquisition..................................................................... 3
2.1.1 Components of a Data Acquisition System .............................................. 3
2.1.2 CR200(X) Mounting ................................................................................. 4
2.1.3 Wiring Panel ............................................................................................. 4
2.1.4 Battery Backup ......................................................................................... 5
2.1.5 Power Supply ............................................................................................ 5
2.1.6 Antenna ..................................................................................................... 5
2.1.7 Analog Sensors ......................................................................................... 6
2.1.8 Bridge Sensors .......................................................................................... 6
2.1.9 Pulse Sensors ............................................................................................ 7
2.1.10 Digital I/O Ports ........................................................................................ 8
2.1.11 RS-232 Sensors ......................................................................................... 9
2.2 Hands-on Exercise - Measuring Temperature ...................................................... 10
2.2.1 Hardware Setup ....................................................................................... 11
2.2.2 Configuration .......................................................................................... 11
2.2.3 PC200W Software Setup ........................................................................ 11
Section 3. Overview .................................................. 23
3.1 CR200(X) Overview ............................................................................................ 23
3.1.1 Programmed Instructions Are Evaluated Sequentially ........................... 24
3.1.2 Sensor Support ........................................................................................ 25
3.1.3 Input / Output Interface: The Wiring Panel ............................................ 25
3.1.4 Power Requirements ............................................................................... 29
3.1.5 Programming: Firmware and User Programs ......................................... 29
3.1.6 Memory and Data Storage ...................................................................... 30
3.1.7 Communications Overview .................................................................... 31
3.1.8 Maintenance Overview ........................................................................... 32
3.2 PC Support Software ............................................................................................ 34
3.3 Specifications ....................................................................................................... 35
Section 4. Sensor Support ....................................... 37
4.1 Powering Sensors ................................................................................................. 37
4.1.1 Switched Precision .................................................................................. 37
4.1.2 Continuous Unregulated (Nominal 12 Volt) ........................................... 37
4.1.3 Switched Unregulated (Nominal 12 Volt) .............................................. 38
4.2 Voltage Measurement .......................................................................................... 38
4.2.1 Measurement Sequence .......................................................................... 38
4.2.2 Measurement Accuracy .......................................................................... 38
4.2.3 Voltage Range......................................................................................... 40
4.2.4 Integration ............................................................................................... 40
4.2.5 Self-Calibration ....................................................................................... 41
4.3 Bridge Resistance Measurements ........................................................................ 41
4.3.1 Measurements Requiring AC Excitation ................................................ 42
i
Table of Contents
4.4 Pulse Count Measurement .................................................................................... 42
4.4.1 Pulse input Channels ............................................................................... 43
4.4.2 Pulse Input on Digital I/O Channels C1–C2 ........................................... 45
4.5 Period Averaging Measurements ......................................................................... 45
4.6 SDI-12 Recording ................................................................................................ 46
4.7 Cabling Effects on Measurements ........................................................................ 46
4.7.1 Analog Sensor Cables ............................................................................. 46
4.7.2 Pulse Sensors ........................................................................................... 46
4.7.3 Serial Sensors .......................................................................................... 47
Section 5. Measurement and Control Peripherals .. 49
5.1 Control Output ..................................................................................................... 49
5.1.1 Binary Control ......................................................................................... 49
5.2 Other Peripherals .................................................................................................. 51
5.2.1 TIMs ........................................................................................................ 51
Section 6. CR200(X) Power Supply .......................... 53
6.1 Power Requirement .............................................................................................. 53
6.2 Calculating Power Consumption .......................................................................... 53
6.3 Power Supplies ..................................................................................................... 53
6.3.1 Battery Connection .................................................................................. 53
Section 7. Grounding ................................................ 55
7.1 ESD Protection ..................................................................................................... 55
7.1.1 Lightning Protection ................................................................................ 56
7.2 Single-Ended Measurement Reference ................................................................ 57
Section 8. CR200(X) Configuration .......................... 59
8.1 DevConfig ............................................................................................................ 59
8.2 Sending the Operating System ............................................................................. 60
8.2.1 Sending OS with DevConfig ................................................................... 60
8.3 Settings ................................................................................................................. 62
8.3.1 Settings via DevConfig ........................................................................... 62
8.3.2 Settings via CRBASIC ............................................................................ 66
8.3.3 Settings via Terminal Emulator ............................................................... 66
8.3.4 Durable Settings ...................................................................................... 67
Section 9. Programming ........................................... 69
9.1 Inserting Comments into Program ........................................................................ 69
9.2 Sending Programs ................................................................................................ 69
9.3 Writing Programs ................................................................................................. 69
9.3.1 Short Cut Editor and Program Generator ................................................ 70
9.3.2 CRBASIC Editor ..................................................................................... 70
9.4 Numerical Formats ............................................................................................... 71
9.5 Structure ............................................................................................................... 72
9.6 Declarations I - Single-line Declarations ............................................................. 73
9.6.1 Variables ................................................................................................. 73
9.6.2 Constants ................................................................................................. 76
9.6.3 Alias and Unit Declarations .................................................................... 77
ii
Table of Contents
9.7 Declarations II - Declared Sequences .................................................................. 77
9.7.1 Data Tables ............................................................................................. 77
9.7.2 Subroutines ............................................................................................. 83
9.8 Program Execution Timing .................................................................................. 83
9.9 Instructions ........................................................................................................... 84
9.9.1 Measurement and Data Storage Processing ............................................ 84
9.9.2 Parameter Types ..................................................................................... 85
9.9.3 Names in Parameters .............................................................................. 85
9.9.4 Expressions in Parameters ...................................................................... 86
9.9.5 Arrays of Multipliers and Offsets ........................................................... 86
9.10 Expressions ........................................................................................................ 87
9.10.1 Floating Point Arithmetic ....................................................................... 87
9.10.2 Mathematical Operations ........................................................................ 87
9.10.3 Logical Expressions ................................................................................ 88
9.11 Program Access to Data Tables .......................................................................... 90
Section 10. CRBASIC Programming Instructions .... 93
10.1 Program Declarations ........................................................................................... 93
10.1.1 Variable Declarations & Modifiers ......................................................... 93
10.1.2 Constant Declarations ............................................................................. 93
10.2 Data Table Declarations ..................................................................................... 94
10.2.1 Data Table Modifiers .............................................................................. 94
10.2.2 Data Storage Output Processing ............................................................. 94
10.3 Single Execution at Compile .............................................................................. 95
10.4 Program Control Instructions ............................................................................. 96
10.4.1 Common Controls ................................................................................... 96
Measurement Instructions .................................................................................. 98
10.5
10.5.1 Diagnostics ............................................................................................. 98
10.5.2 Voltage .................................................................................................... 98
10.5.3 Pulse ........................................................................................................ 98
10.5.4 Digital I/O ............................................................................................... 99
10.5.5 SDI-12..................................................................................................... 99
10.6 Processing and Math Instructions ..................................................................... 100
10.6.1 Mathematical Operators ........................................................................ 100
10.6.2 Logical Operators ................................................................................. 100
10.6.3 Trigonometric Functions ....................................................................... 101
10.6.4 Arithmetic Functions ............................................................................ 102
10.6.5 Spatial Processing ................................................................................. 103
10.6.6 Other Functions..................................................................................... 104
10.7 Clock Functions................................................................................................ 104
10.8 Serial Input / Output ......................................................................................... 105
10.9 Peer-to-Peer PakBus Communications ............................................................. 105
10.10 Data Table Access and Management ............................................................. 106
10.11 SCADA ......................................................................................................... 107
10.12 Satellite Systems Programming ..................................................................... 108
10.12.1 GOES .................................................................................................... 108
Section 11. Programming Resource Library ........... 109
11.1 Remote Sensor Interface .................................................................................... 109
11.2 Radio Power Minimization ................................................................................ 110
11.3 Multiple Switch Closure Measurements ............................................................ 112
11.4 SDI-12 Sensor Support ...................................................................................... 112
11.4.1 SDI-12 Command Basics ...................................................................... 112
11.4.2 SDI-12 Communications ...................................................................... 116
iii
Table of Contents
11.4.3 SDI-12 Power Considerations ............................................................... 118
11.5 Wind Vector ..................................................................................................... 120
11.5.1 OutputOpt Parameters ........................................................................... 120
11.5.2 Wind Vector Processing ........................................................................ 120
11.6 TrigVar and DisableVar - Controlling Data Output and Output Processing .... 125
11.7 Multiple Data Intervals in Data Tables ............................................................. 126
Section 12. Memory and Data Storage .................... 129
12.1 Data Storage ..................................................................................................... 129
12.1.1 Data Table Storage ................................................................................ 129
12.2 Memory Conservation ...................................................................................... 130
12.3 Memory Reset .................................................................................................. 130
12.3.1 Full Memory Reset ................................................................................ 130
12.3.2 Program Send Reset .............................................................................. 130
12.3.3 Manual Data Table Reset ...................................................................... 130
Section 13. Telecommunications and Data
Retrieval .................................................................. 131
13.1 Hardware and Carrier Signal ............................................................................ 131
13.2 Protocols ........................................................................................................... 132
13.3 Initiating Telecommunications ......................................................................... 132
13.4 Data Retrieval ................................................................................................... 132
13.4.1 Via Telecommunications ...................................................................... 132
13.4.2 Data Format on Computer ..................................................................... 132
Section 14. PakBus Overview .................................. 133
14.1 PakBus Addresses ............................................................................................ 133
14.2 Nodes: Leaf Nodes and Routers ....................................................................... 133
14.3 Router and Leaf Node Configuration ............................................................... 134
14.4 Linking Nodes: Neighbor Discovery ................................................................ 134
14.4.1 Hello-message (two-way exchange) ..................................................... 135
14.4.2 Beacon (one-way broadcast) ................................................................. 135
14.4.3 Hello-request (one-way broadcast) ....................................................... 135
14.4.4 Neighbor Lists ....................................................................................... 135
14.4.5 Adjusting Links ..................................................................................... 135
14.4.6 Maintaining Links ................................................................................. 136
14.5 Troubleshooting ................................................................................................ 136
14.5.1 Link Integrity ........................................................................................ 136
14.5.2 Ping ....................................................................................................... 137
14.5.3 Traffic Flow .......................................................................................... 138
14.6 LoggerNet Device Map Configuration ............................................................. 138
Section 15. Alternate Telecoms Resource Library ... 139
15.1 Modbus ............................................................................................................. 139
15.1.1 Overview ............................................................................................... 139
15.1.2 Terminology .......................................................................................... 139
15.1.3 Programming for Modbus ..................................................................... 140
15.1.4 Troubleshooting .................................................................................... 142
iv
Table of Contents
Section 16. Support Software .................................. 143
16.1 Short Cut .......................................................................................................... 143
16.2 PC200W ........................................................................................................... 143
16.3 Visual Weather ................................................................................................. 143
16.4 PC400 ............................................................................................................... 144
16.5 RTDAQ ............................................................................................................ 144
16.6 LoggerNet Suite ............................................................................................... 144
16.7 PDA Software .................................................................................................. 145
16.8 Network Planner ............................................................................................... 145
Section 17. Care and Maintenance .......................... 147
17.1 Temperature Range .......................................................................................... 147
17.2 Moisture Protection .......................................................................................... 147
17.3 Enclosures ........................................................................................................ 147
17.4 Replacing the Internal Battery .......................................................................... 148
Section 18. Troubleshooting .................................... 151
18.1 Programming .................................................................................................... 151
18.1.2 NAN and ±INF ..................................................................................... 153
18.2 Communications ............................................................................................. 154
18.2.1 RS-232 .................................................................................................. 154
18.2.2 Communicating with Multiple PC Programs ........................................ 154
18.3 Power Supply ................................................................................................... 155
18.3.1 Overview ............................................................................................... 155
18.3.2 Troubleshooting at a Glance ................................................................. 155
18.3.3 Diagnosis and Fix Procedures ............................................................... 156
Appendices
Appendix A. Glossary ................................................... 1
A.1 Terms ..................................................................................................................... 1
A.2 Concepts ............................................................................................................... 13
A.2.1 Accuracy, Precision, and Resolution ...................................................... 13
Appendix B. Status Table and Settings .................... 15
Appendix C. Serial Port Pin Outs ............................... 21
C.1 RS-232 Communications Port ............................................................................. 21
C.1.1 Pin-Out .................................................................................................... 21
Appendix D. ASCII / ANSI Table ................................. 23
Appendix E. Antenna Usage and Compliance .......... 27
E.1 Use of Antenna with CR200(X) ........................................................................... 27
E.2 Part 15 FCC Compliance Warning ...................................................................... 27
E.2.1 Use of Approved Antennas ..................................................................... 28
v
Table of Contents
Index .............................................................................. 29
List of Figures
Figure 1: Data Acquisition System Components ........................................................... 3
Figure 2: CR200(X) Wiring Panel ................................................................................. 5
Figure 3: Analog Sensor Wired to Single-Ended Channel #1 ....................................... 6
Figure 4: Half Bridge Wiring -- Wind Vane Potentiometer .......................................... 7
Figure 5: Pulse Input Types ........................................................................................... 7
Figure 6: Pulse Input Wiring -- Anememeter Switch .................................................... 8
Figure 7: Control and Monitoring with Digital I/O ....................................................... 9
Figure 8: Location of RS-232 Port .............................................................................. 10
Figure 9: Use of RS-232 when Reading RS-232 Devices ........................................... 10
Figure 10: Power and RS-232 Connections ................................................................. 11
Figure 11: PC200W Main Window ............................................................................. 13
Figure 12: Short Cut Temperature Sensor Folder ........................................................ 14
Figure 13: Short Cut Thermocoupler Wiring .............................................................. 15
Figure 14: Short Cut Wiring Diagram ......................................................................... 15
Figure 15: Short Cut Outputs Tab ............................................................................... 16
Figure 16: Short Cut Output Table Definition ............................................................. 17
Figure 17: Short Cut Compile Confirmation ............................................................... 17
Figure 18: PC200W Connect Button ........................................................................... 18
Figure 19: PC200W Monitor Data Tab ....................................................................... 19
Figure 20: PC200W Monitor Data Tab ....................................................................... 19
Figure 21: PC200W Collect Data Tab ......................................................................... 20
Figure 22: PC200W View Data Utility ....................................................................... 20
Figure 23: PC200W View Data Table ......................................................................... 21
Figure 24: PC200W View Data Graph ........................................................................ 21
Figure 25: Features of a Data Acquisition System ...................................................... 24
Figure 26: CR200(X) Wiring Panel ............................................................................. 31
Figure 27: Voltage Measurement Accuracy (0° to 40° C) ........................................... 40
Figure 28: Voltage Excitation Bridge Circuit .............................................................. 41
Figure 29: Switch Closure Pulse Sensor ...................................................................... 42
Figure 30: Pulse Input Types ....................................................................................... 44
Figure 31: Amplitude Reduction of Pulse-Count Waveform (before and after
1 ms time constant filter) ...................................................................................... 44
Figure 32: Current Limiting Resistor in a Tipping Bucket Rain Gage Circuit ............ 46
Figure 33: Control Port Current Sourcing ................................................................... 50
Figure 34: Relay Driver Circuit with Relay ................................................................ 51
Figure 35: Power Switching without Relay ................................................................. 51
Figure 36: Lightning Protection Scheme ..................................................................... 57
Figure 37: DevConfig Utility ...................................................................................... 60
Figure 38: DevConfig OS Download Window ........................................................... 61
Figure 39: Dialog Box Confirming OS Download ...................................................... 61
Figure 40: DevConfig Settings Editor ......................................................................... 62
Figure 41: Summary of CR200(X) Configuration ....................................................... 63
Figure 42: DevConfig Deployment Tab ...................................................................... 64
Figure 43: DevConfig Logger Control Tab ................................................................. 65
Figure 44: Entering SDI-12 Transparent Mode ......................................................... 117
Figure 45: Input Sample Vectors ............................................................................... 121
Figure 46: Mean Wind Vector ................................................................................... 123
Figure 47: Standard Deviation of Direction .............................................................. 124
Figure 48: Data from TrigVar Program ..................................................................... 126
vi
Table of Contents
Figure 49: PakBus Network Addressing. .................................................................. 134
Figure 50: Flat Map ................................................................................................... 138
Figure 51: Tree Map .................................................................................................. 138
Figure 52: Enclosure ................................................................................................. 148
Figure 53: Accuracy, Precision, and Resolution .................................................. Ap. 13
List of Tables
Table 1. CR200 series Dataloggers with Built-In Radio .............................................. 2
Table 2. PC200W EZSetup Wizard Example Selections. .......................................... 12
Table 3. Internal Lithium Battery Specifications ....................................................... 34
Table 4. Current Sourcing Limits ............................................................................... 38
Table 5. Formats for Entering Numbers in CRBASIC ............................................... 71
Table 6. CRBASIC Program Structure ...................................................................... 72
Table 7. Predefined Constants and Reserved Words .................................................. 77
Table 8. TOA5 Environment Line ............................................................................. 78
Table 9. Typical Data Table ....................................................................................... 79
Table 10. Rules for Names ......................................................................................... 85
Table 11. Logical Expression Examples .................................................................... 89
Table 12. Abbreviations of Names of Data Processes................................................ 90
Table 13. Derived Trigonometric Functions ............................................................ 101
Table 14. Standard SDI-12 Command & Response Set ........................................... 113
Table 15. Example Power Usage Profile for a Network of SDI-12 Probes .............. 119
Table 16. OutputOpt Options ................................................................................... 120
Table 17. CR200(X) Telecommunications Options ................................................. 131
Table 18. PakBus Link Performance Gage .............................................................. 137
Table 19. Modbus to Campbell Scientific Equivalents ............................................ 139
Table 20. CRBASIC Ports, Flags, Variables and Modbus Registers ....................... 141
Table 21. LoggerNet Products that Include the LoggerNet Server .......................... 144
Table 22. LoggerNet Clients .................................................................................... 145
Table 23. Internal Lithium Battery Specifications ................................................... 149
Table 24. Program Download Errors ....................................................................... 152
Table 25. Math Expressions and CRBASIC Results ................................................ 154
Table 26. Status Table Fields and Descriptions .................................................. Ap. 16
Table 27. CR200(X) Settings .............................................................................. Ap. 18
Table 28. CR200(X) RS-232 Pin-Out ................................................................. Ap. 21
List of CRBasic Examples
CRBASIC EXAMPLE 1. Inserting Comments .......................................................... 69
CRBASIC EXAMPLE 2. Load binary information into a single variable ................. 71
CRBASIC EXAMPLE 3. Proper Program Structure ................................................. 73
CRBASIC EXAMPLE 4. Using a variable array in calculations ............................... 75
CRBASIC EXAMPLE 5. Flag Declaration and Use ................................................. 76
CRBASIC EXAMPLE 6. Using the Const Declaration ............................................. 76
CRBASIC EXAMPLE 7. Alias and Unit Declaration ............................................... 77
CRBASIC EXAMPLE 8. Definition and Use of a Data Table .................................. 80
CRBASIC EXAMPLE 9. Use of the Disable Variable .............................................. 82
CRBASIC EXAMPLE 10. Use of a Subroutine ........................................................ 83
CRBASIC EXAMPLE 11. BeginProg / Scan / NextScan / EndProg Syntax ............. 84
CRBASIC EXAMPLE 12. Measurement Instruction Syntax .................................... 84
CRBASIC EXAMPLE 13. Use of Expressions in Parameters................................... 86
CRBASIC EXAMPLE 14. Use of Arrays as Multipliers and Offsets ....................... 86
CRBASIC EXAMPLE 15. Use of Variable Arrays to Conserve Code Space ........... 88
CRBASIC EXAMPLE 16. Example Wireless Sensor Program For CR200(X) ...... 109
vii
Table of Contents
CRBASIC EXAMPLE 17. CRBASIC EXAMPLE. Radio Power Minimization
Program Examples ............................................................................................. 111
CRBASIC EXAMPLE 18. CRBASIC EXAMPLE. Two Rain Gages on a
CR200(X) ........................................................................................................... 112
CRBASIC EXAMPLE 19. Using TrigVar to Trigger Data Storage ........................ 126
CRBASIC EXAMPLE 20. CRBASIC EXAMPLE. Programming for two data
intervals in one data table ................................................................................... 127
CRBASIC EXAMPLE 21. Using NAN in Expressions ........................................... 153
viii

Section 1. Introduction

Whether in extreme cold in Antarctica, scorching heat in Death Valley, salt spray from the Pacific, micro-gravity in space, or the harsh environment of your office, Campbell Scientific dataloggers support research and operations all over the world. Our customers work a broad spectrum of applications, from those more complex than any of us imagined, to those simpler than any of us thought practical. The limits of the CR200(X) are defined by our customers. Our intent with the CR200(X) manual is to guide you to the tools you need to explore the limits of your application.
You can take advantage of the CR200(X)'s powerful analog and digital measurement features by spending a few minutes working through the
Quickstart Tutorial (p. 3) and the Overview (p. 23). For more demanding
applications, the remainder of the manual and other Campbell Scientific publications are available. If you are programming with CRBASIC, you will need the extensive Help available with the CRBASIC Editor software.
This manual is organized to take you progressively deeper into the complexity of CR200(X) functions. You may not find it necessary to progress beyond the
Quickstart Tutorial (p. 3) or Overview (p. 23) sections. Quickstart Tutorial (p.
3) gives a cursory view of CR200(X) data acquisition and walks you through a first attempt at data acquisition. Overview (p. 23) reviews salient topics, which are covered in-depth in subsequent sections and appendices.
More in-depth study requires other Campbell Scientific publications, most of which are available on-line at www.campbellsci.com. Generally, if a particular feature of the CR200(X) requires a peripheral hardware device, more information is available in the manual written for that device. Manuals for Campbell Scientific products are available at www.campbellsci.com.
If you are unable to find the information you need, please contact us at 435-753­2342 and speak with an applications engineer. Or you can email us at
support@campbellsci.com.

1.1 CR200(X) series Datalogger Models

Models CR200X and CR200 Dataloggers do not have a built-in spread spectrum radio.
The CR206X, CR211X, and CR216X combine the CR200X datalogger with a spread spectrum radio for telemetering data. The different model numbers are for different spread spectrum frequency ranges:
1
Section 1. Introduction
Table 1. CR200 series Dataloggers with Built-In Radio
Model Frequency Where Used
CR206X
CR206 (retired)
CR205 (retired)
CR211X
CR211 (retired)
CR210 (retired)
CR216X
CR216 (retired)
CR215 (retired)
910 to 918 MHz U.S./Canada
920 to 928 MHz Australia/Israel
2.450 to 2.482 GHz
Worldwide
Caution No product using the 24XStream radio, including CR216X, will be available for sale in Europe after 1/1/2015 due to changes in EU legislation. Consequently, purchase of the CR216X is not recommended for use in Europe in new networks that may require future expansion.
The CR295X and CR295 (retired) GOES Dataloggers include an additional 9-pin serial port that allow communications with a TX320, the retired TX312, or the retired SAT HDR GOES satellite transmitter. While the CR295 required a special operating system, the CR295X does not.
Note: Throughout this manual CR200(X) will be used to refer to all of the different models of datalogger in the CR200-series and CR200X-series. In the cases where information applies only to a specific model or series of datalogger, that will be clearly specified.
The CR200(X)-series dataloggers have the following enhanced features as compared to the CR200-series dataloggers:
1. 128 Public variables can be used (CR200-series had 48).
2. 8 Data Tables can be declared (CR200-series had 4).
3. Compiled CRBasic program can be two times larger than for CR200-
series.
4. All CR200(X)-series CRBasic instructions are supported in a single
operating system. See CRBasic and CRBasic Help for a list of available instructions. No new instructions have been added. If new instructions are added in the future, they will apply only to the CR200(X)-series dataloggers.
2

Section 2. Quickstart Tutorial

Quickstart tutorial gives a cursory look at CR200(X) data acquisition.

2.1 Primer - CR200(X) Data Acquisition

Data acquisition with the CR200(X) is the result of a step wise procedure involving the use of electronic sensor technology, the CR200(X), a telecommunications link, and PC datalogger support software.

2.1.1 Components of a Data Acquisition System

A typical data acquisition system is conceptualized in FIGURE. Data
Acquisition System Components (p. 3). A CR200(X) is only one part of a data
acquisition system. To acquire good data, suitable sensors and a reliable data retrieval method are required. A failure in any part of the system can lead to "bad" data or no data.
2.1.1.1 How Programmed Instructions Are Evaluated
2.1.1.2 Sensors
The CR200(X) evaluates programmed instructions sequentially.
Figure 1: Data Acquisition System Components
Suitable sensors accurately and precisely transduce environmental change into measurable electrical properties by outputting a voltage, changing resistance, outputting pulses, or changing states.
Read More! APPENDIX. Accuracy, Precision, and Resolution (Appendix p.
13)
3
Section 2. Quickstart Tutorial
2.1.1.3 Datalogger
2.1.1.4 Data Retrieval
CR200(X)s can measure most sensors with an electrical response. CR200(X)s measure electrical signals and convert the measurement to engineering units, perform calculations and reduce data to statistical values. Every measurement does not need to be stored. The CR200(X) will store data in memory awaiting transfer to the PC via external storage devices or telecommunications.
The main objective of a data acquisition system is to provide data files on a PC.
Data are copied, not moved, from the CR200(X) to the PC. Multiple users may have access to the same CR200(X) without compromising data or coordinating data collection activities.
A RS-232 port is integrated with the CR200(X) wiring panel to facilitate data collection.
On-site serial communications are preferred if the datalogger is near the PC, and the PC can dedicate a serial (COM) port for the datalogger or use a USB-to­serial converter. On-site methods such as direct serial connection or infrared link are also used when the user visits a remote site with a laptop or PDA.
In contrast, telecommunications provide remote access and the ability to discover problems early with minimum data loss. Typically a base station radio that is compatible with the radio internal to the CR200(X) will be the preferred method of telecommunication. A variety of devices, such as telephone modems, satellite transceivers, and TCP/IP network modems may be interfaced with the base station for the most demanding applications.

2.1.2 CR200(X) Mounting

The CR200(X) module integrates electronics within a compact housing, making it economical, small, and very rugged.

2.1.3 Wiring Panel

As shown in FIGURE. CR200(X) Wiring Panel p. 5, the CR200(X) provides terminals for connecting sensors, power and communications devices. Internal surge protection is incorporated with the input channels.
The CR200(X) uses spring-loaded terminal blocks for connecting sensors and peripherals. This provides quick, vibration resistant connections. To attach wires, insert a small flat blade screwdriver into the slot and push back. Insert the wire and then bring the screwdriver forward.
4
Caution! Opening a terminal by prying the end may cause damage, particularly at low temperatures.
Figure 2: CR200(X) Wiring Panel
Section 2. Quickstart Tutorial

2.1.4 Battery Backup

A lithium battery backs up the CR200(X) clock, program, and memory if it loses power.

2.1.5 Power Supply

The CR200(X) is powered by a nominal 12 volt DC source. Acceptable power range is 7 to 16 VDC.
The CR200(X) does not have an internal power supply but does have connections for an external battery and a built-in charging regulator for charging a 12 V lead-acid battery from an external power source. Charging power can come from a 16-22 VDC input such as a solar panel.

2.1.6 Antenna

For CR200(X) models with a built-in radio, an FCC authorized antenna is a required component. An SMA male connector is provided on the CR200(X) wiring panel for antenna connection. Antennas are either 900 MHz or 2.4 GHz depending on the type of radio installed.
5
Section 2. Quickstart Tutorial

2.1.7 Analog Sensors

Analog sensors output continuous voltages that vary with the phenomena measured.
Analog sensors connect to analog terminals. Analog terminals are configured as single-ended, wherein sensor outputs are measured with respect to ground (FIGURE. Analog Sensor Wired to Single-Ended Channel #1 (p. 6)). The CR200(X) cannot perform differential voltage measurements.
Figure 3: Analog Sensor Wired to Single-Ended Channel #1

2.1.8 Bridge Sensors

Bridge sensors change resistance with respect to environmental change. Resistance is determined by measuring the difference between the excitation voltage supplied to the bridge and the voltage detected by the CR200(X) returning from the bridge.
2.1.8.1 Voltage Excitation
The CR200(X) supplies a precise excitation voltage via excitation terminals. Return voltage is measured on single ended analog terminals. Because the CR200(X) cannot make the differential voltage readings used with full bridge and some half bridge circuits, only basic half bridge measurements can be made. A wiring example is illustrated in FIGURE. Half Bridge Wiring Wind Vane
Potentiometer p. 7.
6
Section 2. Quickstart Tutorial
Figure 4: Half Bridge Wiring -- Wind Vane Potentiometer

2.1.9 Pulse Sensors

The CR200(X) can measure switch closures, low-level AC signals (waveform breaks zero volts), or voltage pulses. Compatible signal types are illustrated in
FIGURE. Pulse Input Types (p. 7). A pulse input wiring example is shown in FIGURE. Pulse Input Wiring -- Anemometer Switch (p. 8).
Note Period averaging sensors are connected to analog channels.
Figure 5: Pulse Input Types
7
Section 2. Quickstart Tutorial
Figure 6: Pulse Input Wiring -- Anemometer Switch

2.1.10 Digital I/O Ports

The CR200(X) has 2 digital I/O ports selectable, under program control, as binary inputs or control outputs. These are multi-function ports including: device driven interrupts, switch closure pulse counting, high frequency pulse counting, and SDI-12 communications. FIGURE. Control and Monitoring with
Digital I/O (p. 9), illustrates a simple application wherein a port is used to
control a device while a second port monitors the state of the device.
8
Section 2. Quickstart Tutorial
Figure 7: Control and Monitoring with Digital I/O

2.1.11 RS-232 Sensors

The CR200(X) has an RS-232 input as shown in FIGURE. Location of RS-232
Port p. 10. As indicated in FIGURE. Use of RS-232 when Reading RS-232 Devices, p. 10 RS-232 sensors can be connected to the RS-232 port. The port
can be set up with various baud rates, parity options, stop bit options, and so forth as defined in CRBASIC Help.
Note: For the CR200, SerialInput () is a special instruction, which is available only in the special S operating system.
9
Section 2. Quickstart Tutorial
Figure 8: Location of RS-232 Port
Figure 9: Use of RS-232 when Reading RS-232 Devices

2.2 Hands-on Exercise - Measuring Temperature

This tutorial is designed to illustrate the function of the CR200(X). During the exercise, the following items will be described.
Attaching a temperature probe to analog differential terminals
Creating a program for the CR200(X)
10
Making a simple temperature measurement
Sending data from the CR200(X) to a PC
Viewing the data from the CR200(X)

2.2.1 Hardware Setup

With Reference to FIGURE. Power and RS-232 Connections (p. 11).
1. Connect external power (7 – 16VDC) to the CR200 by inserting the
positive lead into the "Battery +".
2. Insert the negative lead into the "Battery-".
3. Connect the RS-232 cable (PN 10873, provided) between the RS-232
port on the CR200(X) and the RS-232 port on the PC. For computers that have only a USB port, a USB Serial Adaptor (PN 17394 or equivalent) is required.
Section 2. Quickstart Tutorial
Figure 10: Power and RS-232 Connections

2.2.2 Configuration

For this exercise, factory default settings will work. To change the PakBus address or radio settings from their factory defaults, or if you are not sure what settings are currently stored on the CR200(X), use Device Configuration Utility or DevConfig software.
Read More! See DevConfig p. 59

2.2.3 PC200W Software Setup

1. Install the PC200W software onto a PC. Follow the on-screen prompts
during the installation process for the Program Folder and Destination Location.
2. Open the PC200W software (FIGURE. PC200W Main Window (p.
13)). When the software is first run, the EZSetup Wizard will be run automatically in a new window. This will configure the software to communicate with the CR200(X). TABLE. PC200W EZSetup Wizard
11
Section 2. Quickstart Tutorial
Example Selections (p. 12) indicates what information needs to be
entered on each screen. Click on Next at the bottom of the screen to advance to the next screen.
Table 2. PC200W EZSetup Wizard Example Selections.
Start the wizard to follow table entries
Screen Name Information Needed
Introduction Provides and introduction to the EZSetup Wizard along with
Datalogger Type and Name Select the CR200(X) from the scroll window.
COM Port Selection Select the correct COM port for RS-232 connection.
Datalogger Settings Used to configure how the CR200(X) communicates through
Communication Setup Summary
Communications Test A communications test between the CR200(X) and PC can
instructions on how to navigate through the wizard.
Accept the default name of "CR200(X)."
Typically, this will be COM1. Other COM numbers are possible, especially when using a USB to serial cable.
Leave the COM Port Communication Delay at "00 seconds."
Note: When using a USB to serial cable, the COM number may change if the cable is moved to a different USB port. This will prevent data transfer between the software and CR200(X). Should this occur, simply move the USB cable back to the original port. If this is not possible, it will be necessary to close the PC200W software and open it a second time to refresh the available COM ports. Click on "Edit Datalogger Setup" and change the COM port to the new port number.
the COM port.
For this tutorial, accept the default settings.
Provides a summary of the settings made in previous screens.
be performed in this screen.
For this tutorial, the test is not required. Press Finish to exit the Wizard.
12
After exiting the wizard, the main PC200W window becomes visible. The window has several tabs available. By Default, the Clock/Program tab is visible. This tab displays information on the currently selected datalogger along with clock and program functions. The Monitor Data or Collect Data tabs may be selected at any time.
A number of icons are available across the top of the window. These access additional functions available to the user.
Section 2. Quickstart Tutorial
Figure 11: PC200W Main Window
2.2.3.1 Programming With Short Cut
2.2.3.1.1 Short Cut Programming Objectives
This portion of the tutorial will use Short Cut to create a program that measures air temperature (°C) with a 109 Temperature Probe, and rainfall (mm) with a TE525WS rain gage. The CR200(X) will take samples every ten seconds and store averages of these values at one minute intervals.
Even if the 109 Temperature Probe and TE525WS Rain Gage sensors are not available, the programming example can still be followed. Without a 109 probe connected the measurement result will be NAN; without a TE525WS connected the measurement result will be 0. A rain gage can be simulated by straightening a segment of each of two paper clips and inserting the straightened segment of one paper clip into P_SW and the adjacent ground channel. To simulate a rain gage tip, squeeze the paper clips together until they touch and then allow them to spring apart.
2.2.3.1.2 Procedure (Short Cut Steps 1–6)
1. Click on the Short Cut icon in the upper-right corner of the PC200W
window. The icon resembles a clock face.
13
Section 2. Quickstart Tutorial
2. A new window will appear showing the option to create a new program
or open an existing program. Select New Program.
3. A drop-down list will appear showing different dataloggers. Select the
CR200(X) and click OK.
4. The program will now ask for the scan interval. Set the interval to 10
seconds and click OK.
5. A second prompt will ask for a choice of "Sensor Support." Select
"Campbell Scientific, Inc."
6. Under Available Sensors, expand the "Sensors" folder by clicking on
the "+" symbol. This shows several sub-folders. Expand the "Temperature" folder to view the available sensors.
14
Figure 12: Short Cut Temperature Sensor Folder
2.2.3.1.3 Procedure (Short Cut Steps 7–9)
1. Double-click the 109 Temperature Probe sensor to add it to the
Selected category. Alternatively, highlight the Wiring Panel Temperature sensor by clicking on it once, and then click on the arrow between Available Sensors and Selected to add it to the Selected sensors.
2. Click OK on the next screen to accept T109_C for the measurement
label, the DegC for the units.
3. Double click on the Meteorological application group. Double click
on Precipitation, and double click on the TE525 / TE525WS sensor to add it to the selected sensors table. Click OK to accept Rain_mm for the measurement label, and mm for the units.
Figure 13: Short Cut Thermocouple Wiring
2.2.3.1.4 Procedure (Short Cut Step 10)
Section 2. Quickstart Tutorial
1. Click on the Wiring Diagram link to view the sensor wiring diagram.
Attach the 109 Temperature Probe and TE525 Rain Gauge to the CR200(X) as shown in the diagram. Click on Outputs to advance to the next step.
Figure 14: Short Cut Wiring Diagram
2.2.3.1.5 Procedure (Short Cut Step 11)
1. The Outputs window displays a list of selected sensors on the left, and
data storage Tables on the right.
15
Section 2. Quickstart Tutorial
Figure 15: Short Cut Outputs Tab
2.2.3.1.6 Procedure (Short Cut Steps 12 –18)
1. By default, there are two Tables initially available. Both Tables have a
Store Every field along with a drop-down box to select the time units. These are used to set the time interval when data is stored.
2. Only one Table is needed for this tutorial, so Table 2 can be removed.
Select Table 2 by clicking on its tab, and then click on Delete Table.
3. Change the Table Name to OneMin, and then change the interval to 1
minute (Store Every 1 Minutes).
4. Adding a measurement to the table is done by selecting the
measurement under Selected Sensors, and then clicking on one of the processing buttons in the center of the window.
5. Click the Default sensor (battery voltage) and click the Minimum
button. Click the 109 temperature sensor and click the Average button. Click the TE525 rain gauge sensor and click the Total button.
6. Click the Default sensor (battery voltage) and double click the
Minimum button. Click the 109 temperature sensor and double click the Average button. Click the TE525 rain gauge sensor and double click the Total button.
16
7. Click the Default sensor (battery voltage) and double click the
Minimum button. Do not store the time of minimum. Click the 109 temperature sensor and double click the Average button. Click the TE525 rain gauge sensor and double click the Total button..
Figure 16: Short Cut Output Table Definition
2.2.3.1.7 Procedure (Short Cut Step 19)
Section 2. Quickstart Tutorial
1. Click on Finish to compile the program. Give the program the name
"QuickStart." A prompt will ask if you want to send the program to the datalogger. For this exercise choose No. A summary screen will appear showing the compiler results. Any errors during compiling will also be displayed.
Figure 17: Short Cut Compile Confirmation
2.2.3.1.8 Procedure (Short Cut Step 20)
1. Close this window by clicking on the "X" in the upper right corner.
17
Section 2. Quickstart Tutorial
2.2.3.2 Programming the CR200(X) and Collecting Data
2.2.3.2.1 Procedure (PC200W Step 1)
1. From the PC200W Clock/Program tab, click on the Connect button to
establish communications with the CR200(X). When communications have been established, the text on the button will change to Disconnect.
Figure 18: PC200W Connect Button
2.2.3.2.2 Procedure (PC200W Steps 2–4)
1. Click the Set Clock button to synchronize the datalogger's clock with
the computer's clock.
2. Click on the Send Program button. A window will appear warning that
data on the datalogger will be erased. Answer "yes" to the prompt. Another window will open. Browse to the C:\CampbellSci\SCWin folder, select the QuickStart.CR2 file, and then click the Open button. A status bar will appear while the program is sent to the CR200(X) followed by a confirmation that the transfer was successful. Click OK to close this window.
3. After sending a program to the CR200(X), a good practice is to
monitor the measurements to ensure they are reasonable. Select the Monitor Data tab. The window now displays data found in the Public Table coming from the CR200(X). To view the OneMin table, select an empty cell in the display area, and then click on the Add button.
18
Figure 19: PC200W Monitor Data Tab
2.2.3.2.3 Procedure (PC200W Step 5)
Section 2. Quickstart Tutorial
1. In the Add Selection window, click on the OneMin table, and then
click Paste. The OneMin table is now displayed in the main display.
Figure 20: PC200W Monitor Data Tab
2.2.3.2.4 Procedure (PC200W Step 6)
1. Click on the Collect Data tab. From this window, data is chosen to be
collected as well as the location where the collected data will be stored.
19
Section 2. Quickstart Tutorial
2.2.3.2.5 Procedure (PC200W Steps 7–9)
Figure 21: PC200W Collect Data Tab
1. Click the OneMin box so a check mark appears in the box. Under the
"What to Collect" heading, select "New data from datalogger." This selects which data will be collected.
2. Click on the Collect button. A progress bar will appear as the data is
collected, followed by the message, "Collection Complete." Click OK to continue.
3. To view the data, click on the View icon at the top of the window. This
opens a new window.
20
Figure 22: PC200W View Data Utility
2.2.3.2.6 Procedure (PC200W Step 10)
1. Click on the Open File icon to open a file for viewing. Select the
"CR200Series_OneMin.dat" file and click on Open. The collected data is now shown.
Figure 23: PC200W View Data Table
Section 2. Quickstart Tutorial
2.2.3.2.7 Procedure (PC200W Step 11)
1. Select any data column by clicking on it. To display the data in graphical
form, click on one of the Show Graph buttons. A graph with one Y-axis or two Y-axes will be generated.
Figure 24: PC200W View Data Graph
2.2.3.2.8 Procedure (PC200W Step 12)
1. Close the Graph and View windows, and then close the PC200W program.
21
Section 2. Quickstart Tutorial
22

Section 3. Overview

3.1 CR200(X) Overview

The CR200(X) Datalogger is a precision instrument designed for low-power measurement applications. CPU, analog inputs, digital outputs, and memory are controlled by the operating system in conjunction with the user program. The user program is written in CRBASIC, a programming language that includes data processing and analysis routines and a standard BASIC instruction set. Campbell Scientific's datalogger support software facilitates program generation, editing, data retrieval, and real-time data monitoring (see Support
Software (p. 143)).
FIGURE. Features of a Data Acquisition System (p. 24) illustrates a common
CR200(X)-based data acquisition system.
The CR200(X) is a multimeter with memory and timekeeping. It is one part of a data acquisition system. To acquire quality data, suitable sensors and reliable telecommunications devices are also required.
Sensors transduce phenomena into measurable electrical forms, outputting voltage, current, resistance, pulses, or state changes. The CR200(X), sometimes with the assistance of various peripheral devices, can measure most electronic sensors. Contact a Campbell Scientific applications engineer if you have questions about a sensor's compatibility with a CR200(X) datalogger.
The CR200(X) measures analog voltage and pulse signals, representing the magnitudes numerically. Numeric values are scaled to the unit of measure such as millivolts and pulses, or in user specified engineering units such as wind direction and wind speed. Measurements can be processed through calculations or statistical operations and stored in memory awaiting transfer to a PC via external storage or telecommunications.
23
Section 3. Overview
24
Figure 25: Features of a Data Acquisition System

3.1.1 Programmed Instructions Are Evaluated Sequentially

The CR200(X) evaluates programmed instructions sequentially.

3.1.2 Sensor Support

Read More! See Sensor Support (p. 37)
The following sensor types are supported by the CR200(X) datalogger.
Analog voltage
Analog current (with a shunt resistor)
Resistive bridges
Pulse output
Period output
Frequency output
SDI-12 sensors
A library of sensor manuals and application notes are available at www.campbellsci.com to assist in measuring many sensor types. Consult with a Campbell Scientific applications engineer for assistance in measuring unfamiliar sensors.
Section 3. Overview

3.1.3 Input / Output Interface: The Wiring Panel

The wiring panel of the CR200(X) is the interface to all CR200(X) functions. Most CR200(X) functions are best introduced by reviewing features of the CR200(X) wiring panel. FIGURE. CR200(X) Wiring Panel (p. 5) illustrates the wiring panel and some CR200(X) functions accessed through it.
Read More! Read Measurement and Control Peripherals (p. 49 information.
3.1.3.1 Measurement Inputs
Measurements require a physical connection with a sensor at an input channel and CRBASIC programming to instruct the CR200(X) how to make, process, and store the measurement. The CR200(X) wiring panel has the following input channels:
Analog Voltage: 5 channels (SE 1–5).
Input voltage range: 0 mV to 2500 mV.
Measurement resolution: 0.6 mV
) for more
25
Section 3. Overview
Period Average: 4 channels (SE 1–4)
Maximum input voltage: 4000 mV.
Maximum frequency: 150 kHz
Voltage threshold: counts cycles on transition from < 900 mV to >
2100 mV.
Note Both pulse count and period average measurements are used to measure frequency output sensors. Yet pulse count and period average measurement methods are different. Pulse count measurements use dedicated hardware -­pulse count accumulators, which are always monitoring the input signal, even when the CR200(X) is between program scans. In contrast, period average measurement instructions only monitor the input signal during a program scan. Consequently, pulse count scans can usually be much less frequent than period average scans. Pulse counters may be more susceptible to low frequency noise because they are always "listening", whereas period averaging may filter the noise by reason of being "asleep" most of the time. Pulse count measurements are not appropriate for sensors that are powered off between scans, whereas period average measurements work well since they can be placed in the scan to execute only when the sensor is powered and transmitting a correct signal.
Period average measurements utilize 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. The frequency resolution of pulse count measurements can be improved by extending the measurement interval by increasing the scan interval and by averaging.
Pulse: 2 channels (P_SW, P_LL) configurable for counts or frequency of the following signal types:
High level square waves (P_SW)
Switch closures (P_SW)
Low-level A/C sine waves (P_LL)
Digital I/O: 2 channels (C1 - C2) configurable for SDI-12 communication, state, frequency, and pulses. 5 analog channels (SE1–SE5) configurable for input/output.
C1 - C2: state, frequency, pulse.
C1: SDI-12 input/output, state, frequency, pulse.
SE 1–5: input/output, state.
26
3.1.3.2 Voltage Outputs
Read More! See Control Output (p. 49).
Switched Analog Output (Excitation): two channels (VX1/VX2) for
precise voltage excitation ranging from +2500 mV or +5000 mV. These channels are regularly used with resistive bridge measurements. Each channel will source up to 25 mA.
Digital I/O: 2 channels (C1 - C2) configurable for on / off and pulse output
duration.
Switched 12 Volts (SW Battery): (switch on / off ) primary voltage under
program control for control of external devices requiring 12V DC, such as humidity sensors. SW Battery can source up to 900 mA. See TABLE.
Current Sourcing Limits p. 38.
CR200(X) used as a PLC (programmable logic controller): Utilizing
peripheral relays and analog output devices, the CR200(X) can manage binary and variable control devices through the following output channels:
Digital I/O: 2 channels (C1/C2) configurable for pulse output duration.
Section 3. Overview
Switched 12 Volts (SW Battery): (switches on/off) primary voltage
under program control for control of external devices requiring 12V DC, such as humidity sensors. SW Battery can source up to 900 mA. See TABLE. Current Sourcing Limits p. 38.
3.1.3.3 Grounding Terminals
Read More! See Grounding (p. 55).
Proper grounding will lend stability and protection to a data acquisition system. It is the easiest and least expensive insurance against data loss-and the most neglected. The following terminals are provided for connection of sensor and datalogger grounding:
Signal Grounds: 6 ground terminals (
analog inputs, pulse inputs, excitation returns, and as a ground for sensor shield wires. Signal returns for pulse inputs should use next to pulse inputs.
Power Grounds: 6 terminals (G) used as returns for 5V, SW Battery, 12V,
and C1-C2 outputs. 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.
) used as reference for single-ended
terminals located
Ground Lug: 1 terminal (
), the large ground lug is used to connect a heavy gage wire to earth ground. A good earth connection is necessary to secure the ground potential of the datalogger and shunt transients away from electronics. Minimum 14 AWG wire is recommended.
27
Section 3. Overview
3.1.3.4 Power Terminals
Read More! See CR200(X) Power Supply (p. 53).
Power In
Power Supply: External battery is connected to Battery+ and Battery-
terminals.
Input voltages in excess of 18 V may damage the CR200 and/or power
supply. Power to charge a 12 V lead-acid battery (16-22 VDC) must be connected to the Charge+ and Charge- terminals NOT to Battery+ and Battery-.
Power Out
Peripheral 12 V Power Source: 1 terminal (SWBattery) and the associated
ground (G) supply power to sensors and peripheral devices requiring nominal 12 VDC. Sensors and peripheral devices may also share a connection to the Battery+ and Battery- terminals which is the same as connecting them directly to the battery. This supply may drop as low as 7 VDC before datalogger operation stops. Precautions should be taken to minimize the occurrence of invalid data from underpowered sensors.
3.1.3.5 Communications Ports
Read More! See Telecommunications and Data Retrieval (p. 131) and PakBus
Overview (p. 133).
The CR200(X) is equipped with an RS-232 communications port. This port allows the CR200(X) to communicate with other computing devices, such as a PC, or with other Campbell Scientific dataloggers.
Note RS-232 communications normally operate well up to a transmission cable capacitance of 2500 picofarads, or approximately 50 feet of commonly available serial cable.
9-pin RS-232: Non-isolated port for communicating with a PC through the
supplied serial cable, serial sensors, or through 3rd party serial telecommunications devices. Acts as a DTE device with a null-modem cable.
Read More! See APPENDIX. Serial Port Pin Outs (Appendix p. 21
Some versions of the CR200(X) include an optional spread spectrum radio for wireless communication with other devices equipped with a spread spectrum radio.
).
28

3.1.4 Power Requirements

Read More! See CR200(X) Power Supply (p. 53).
The CR200(X) operates from a DC power supply with voltage ranging from 7 to 16 V, and is internally protected against accidental polarity reversal. The CR200(X) has modest input power requirements, typically an average current drain of less than 3 mA. Models with built-in radios may have a higher average current drain, depending on the radio’s power mode and amount of time the radio is in use. Be sure to include the current usage of the radio and any powered sensors when calculating power supply requirements.
In low power applications, the CR200(X) 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, an AC/DC wall adapter and a rechargeable battery can be used to construct a UPS (uninterruptible power supply) in conjunction with the CR200(X)'s built-in voltage regulator/charge controller. Contact a Campbell Scientific applications engineer for assistance in acquiring the items necessary to construct a UPS.
Applications requiring higher current requirements, such as satellite or cellular phone communications, should be evaluated by means of a power budget with a knowledge of the factors required by a robust power system. Contact a Campbell Scientific applications engineer if assistance is required in evaluating power supply requirements.
Section 3. Overview
Common power devices are:
Batteries
Alkaline D-cell - 1.5 V/cell
Rechargeable Lead-Acid battery
Charge Sources
Solar Panels
Wind Generators
AC/DC wall adapters

3.1.5 Programming: Firmware and User Programs

The CR200(X) is a programmable instrument, adaptable to demanding measurement and telecommunications requirements.
29
Section 3. Overview
3.1.5.1 Firmware: OS and Settings
Read More! See CR200(X) Configuration (p. 59).
Firmware consists of the operating system (OS) and durable configuration settings. OS and settings remain intact when power is cycled.
Note The CR200(X) is shipped factory ready with all settings and firmware necessary to communicate with a PC via RS-232 and to accept and execute user application programs. OS upgrades are occasionally made available at
www.campbellsci.com.
For more complex applications, some settings may need adjustment. Adjustments are accomplished with DevConfig Software (DevConfig (p. 59)) or through datalogger support software (see Support Software (p. 143)).
OS files are sent to the CR200(X) with DevConfig or through the program Send button in datalogger support software. When the OS is sent via DevConfig, most settings are cleared, whereas, when sent via datalogger support software, most settings are retained.
3.1.5.2 User Programming
Read More! See Programming (p. 69) and CRBASIC Programming
Instructions (p. 93) and CRBASIC help for more programming assistance.
A CRBASIC program directs the CR200(X) how and when sensors are to be measured, calculations made, and data stored. A program is created on a PC and sent to the CR200(X). Two Campbell Scientific software applications, Short Cut and CRBASIC Editor, create CR200(X) programs.
Short Cut creates a datalogger program and wiring diagram in four easy
steps. It supports most sensors sold by Campbell Scientific and is recommended for creating simple programs to measure sensors and store data.
Programs generated by Short Cut are easily imported into CRBASIC Editor
for additional editing. For complex applications, experienced programmers often create essential measurement and data storage code with Short Cut, then edit the code with CRBASIC Editor. Note that once a Short Cut generated program has been edited with CRBASIC Editor, it can no longer be modified with Short Cut.

3.1.6 Memory and Data Storage

30
Read More! See Memory and Data Storage (p. 129).
The CR200(X) has 2K SRAM for communication buffers, calculations, and variables, and 60K Flash EEPROM for the operating system and user program. The CR200 originally had a 128K Serial Flash EEPROM for data storage. Campbell Scientific has increased the data storage memory from 128 kbytes to
Section 3. Overview
512 kbytes in newer CR200s and in all CR200(X)s. CR200s with the increased memory have "512K" on their label.
Figure 26: CR200(X) Wiring Panel

3.1.7 Communications Overview

Read More! See Telecommunications and Data Retrieval (p. 131).
The CR200(X) communicates with external devices to receive programs, send data, or act in concert with a network. The primary communication protocol is PakBus. Modbus is also supported.
3.1.7.1 PakBus
Read More! See PakBus Overview (p. 133).
The CR200(X) communicates with Campbell Scientific support software, telecommunication peripherals, and other dataloggers via PakBus, a proprietary network communications protocol. PakBus is a protocol similar in concept to IP (Internet protocol). By using signatured data packets, PakBus increases the number of communications and networking options available to the CR200(X). Communication can occur via RS-232 or RF.
31
Section 3. Overview
Advantages of PakBus:
Simultaneous communication between the CR200(X) and other devices.
Peer-to-peer communication-no PC required.
Other PakBus dataloggers can be used as "sensors" to consolidate all data
into one CR200(X).
Routing - the CR200(X) cannot act as a router, passing on messages
intended for another logger, but other dataloggers can. PakBus supports automatic route detection and selection.
Datalogger to datalogger communications-special CRBASIC instructions
simplify transferring data between dataloggers for distributed decision making or control.
In a PakBus network, each datalogger is set to a unique address before
being installed in the network. Default PakBus address is 1. To communicate with the CR200(X), the datalogger support software (see
Telecommunications and Data Retrieval (p. 131)) must know the
CR200(X)'s PakBus address. The PakBus address is changed using the DevConfig software, CR200(X) status table, or PakBus Graph software.
3.1.7.2 Modbus
Read More! See Modbus (p. 139).
The CR200(X) supports Modbus Master and Modbus Slave communication for inclusion in Modbus SCADA networks.

3.1.8 Maintenance Overview

Read More! See Care and Maintenance.
With reasonable care, the CR200(X) should give many years of reliable service.
3.1.8.1 Protection from Water
The CR200(X) and most of its peripherals must be protected from moisture. Moisture in the electronics will seriously damage, and probably render un­repairable, the CR200(X). Water can come from flooding or sprinkler irrigation, but most often comes as condensation. In most cases, protecting from water is as easy as placing the CR200(X) in a weather tight enclosure with desiccant and elevating the enclosure above the ground. The CR200(X) is shipped with desiccant to reduce humidity. Desiccant should be changed periodically. 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.
32
3.1.8.2 Protection from Voltage Transients
Read More! See Grounding (p. 55).
The CR200(X) must be grounded to minimize the risk of damage by voltage transients associated with power surges and lightning induced transients. Earth grounding is required to form a complete circuit for voltage clamping devices internal to the CR200(X).
3.1.8.3 Calibration
Read More! See Self-Calibration p. 41.
The CR200(X) uses an internal voltage reference to routinely calibrate itself.
3.1.8.4 Replacing the Internal Battery
Caution Fire, explosion, and severe burn hazard! Misuse or improper installation of the 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.
Section 3. Overview
The CR200(X) contains a lithium battery that operates the clock and SRAM when the CR200(X) is not powered. The CR200(X) does not draw power from the lithium battery while it is powered by an external source. In a CR200(X) stored at room temperature, the lithium battery should last approximately 5 years (less at temperature extremes). Where the CR200(X) is powered most or all of the time the lithium cell should last much longer.
The internal lithium battery must be replaced periodically. Factory replacement is recommended. Contact Campbell Scientific to obtain an RMA prior to shipping the CR200(X).
If the lithium cell is removed or allowed to discharge below the safe level, the CR200(X) will still operate correctly while powered. Without the lithium battery, the clock will reset and data is lost when power is removed.
A replacement lithium battery can be purchased from Campbell (part number
15598). TABLE. CR200(X) Lithium Battery Specifications p. 33 lists the specifications of the battery. However, Campbell Scientific recommends that the battery be replaced at the factory.
33
Section 3. Overview

3.2 PC Support Software

Table 3. Internal Lithium Battery Specifications
Manufacturer Renata
Model CR2016 (3.6V)
Capacity 80 mAh
Self-discharge rate 1%/year @ 23°C
Operating temperature range -40°C to +85°C
Read More! See Support Software (p. 143).
Several datalogger support software products for Windows are available. Software for datalogger setup and simple applications, PC200W and Short Cut, are available at no cost at www.campbellsci.com. For more complex programming, telecommunications, networking, and reporting features, full­featured products are available from Campbell Scientific.
PC200W Starter Software is available at no charge at
www.campbellsci.com. It supports a transparent RS-232 connection
between PC and CR200(X), and includes Short Cut for creating CR200(X) programs. Tools for setting the datalogger clock, sending programs, monitoring sensors, and on-site viewing and collection of data are also included.
PC400 supports a variety of telecommunication options, manual data
collection, and data monitoring displays. Short Cut and CRBASIC Editor are included for creating programs. PC400 does not support complex communication options, such as phone-to-RF, PakBus® routing, or scheduled data collection.
LoggerNet supports combined telecommunication options, customized data
monitoring displays, and scheduled data collection. It includes Short Cut and CRBASIC Editor for creating programs. It also includes tools for configuring, trouble-shooting, and managing datalogger networks. LoggerNet Admin and LoggerNet Remote are also available for more demanding applications.
34

3.3 Specifications

Section 3. Overview
35
Section 3. Overview
36

Section 4. Sensor Support

Several features give the CR200(X) the flexibility to measure many sensor types. Contact a Campbell Scientific applications engineer if assistance is required to assess sensor compatibility.

4.1 Powering Sensors

Read More! See CR200(X) Power Supply (p. 53).
The CR200(X) is a convenient router of power for sensors and peripherals requiring a 2.5, 5 or 12 VDC source. It has one program-controlled switched 12 Volt terminal (SW Battery), and two switched voltage excitation terminals (VX1, VX2). These terminals limit current internally for protection against accidental short circuits. Sensors can be powered continuously by connecting to the Battery + terminal, which is the same as connecting sensors directly to the external battery.
Voltage on the Battery + and SW Battery terminals will changed with the DC supply used to power the CR200(X). The switched voltage excitation terminals are typically used to supply a brief excitation for a bridge measurement with the ExDelSE () instruction, but can also be programmed to provide a continuous 2.5 V or 5 V using the Excite () instruction, which is enough to power many sensors. Switched Unregulated (Nominal 12 Volt) (p. 38) shows the current limits of SW Battery. Greatly reduced output voltages associated with SW Battery, VX1, and VX2 due to current limit may occur if the current limits given in the table in TABLE. Current Sourcing Limits p. 38 are exceeded.

4.1.1 Switched Precision

Voltage (0, 2500, 5000 mV)
Two switched analog output (excitation) terminals, VX1 and VX2, operate under program control. Check the accuracy specification of these channels in
Specifications (p. 35) to understand their limitations. Specifications are only
applicable for loads not exceeding ±25 mA for 2.5 V excitation, or 10 mA for 5 V excitation. CRBASIC instructions that control excitation channels include:
ExDelSE ()
ExciteV ()

4.1.2 Continuous Unregulated (Nominal 12 Volt)

Voltage on the Battery + terminal will change with the CR200(X) external battery voltage.
37
Section 4. Sensor Support

4.1.3 Switched Unregulated (Nominal 12 Volt)

Voltage on the SW Battery terminal will change with CR200(X) supply voltage. The CRBASIC instruction SWBatt () controls the SW Battery terminal.
Table 4. Current Sourcing Limits
Terminal
VX1, VX2 25 mA @ 2.5V
SW Battery < 900 mA @ 20°C
Limit
10 mA @ 5V
< 729 mA @ 40°C
< 630 mA @ 50°C
< 567 mA @ 60°C
< 400 mA @ 85°C

4.2 Voltage Measurement

4.2.1 Measurement Sequence

The first step in a voltage measurement is a calibration to measure the ground offset. The calibration is performed once for each voltage measurement. The CR200(X) measures analog voltages with a sample and hold analog to digital (A/D) conversion. The A/D conversion is made with a 12-bit successive approximation technique which resolves the signal voltage to one part in 4096 of the full scale 2.5 V range, which is 0.6 millivolts.
38
To reduce noise, 10 measurements are rapidly made and averaged to form the result returned. The measurements that go into the average each take about 26 microseconds.

4.2.2 Measurement Accuracy

CR200(X) analog measurement error is calculated as
Error = Gain Error (%) + Offset Error
Gain error is expressed as ±% and is a function of input voltage and CR200(X) temperature. It increases with component temperature and aging. Between ­40°C and +50°C, gain error is typically ±0.25% of the reading with a 1.2 millivolt offset. Worst case over that same temperature range is ±1% of the reading with a 2.4 millivolt offset.
FIGURE. Voltage Measurement Accuracy (-40° to +50°C) p. 40 illustrates that
as magnitude of input voltage decreases, measurement error decreases.
Section 4. Sensor Support
Note The accuracy specification includes only the CR200(X)’s contribution to measurement error. It does not include the error of sensors.
For example, assume the following (see Specifications (p. 35)):
Input Voltage: +2000 mV
Programmed Measurement Instruction: VoltSE ()
CR200(X) Temperature: Between -40°C and +50°C
Accuracy of the measurement is calculated as follows:
Error = Gain Error + Offset Error,
where
Gain Error = ± (2000 * 0.0025)
= ±5 mV
and
Offset Error = 1.2mV
Therefore,
Error = Gain Error + Offset Error
= ±5 mV + 1.2 mV.
= ±6.2 mV
A worst case accuracy in these conditions is
Error = ±(2000 mV * 0.01 + 2.4 mV) = ±22.4 mV
In contrast, the error for a 500 mV input under the same constraints is ±2.45 mV typical and ±7.4 mV worst case.
39
Section 4. Sensor Support
Figure 27: Voltage Measurement Accuracy (0° to 40° C)

4.2.3 Voltage Range

The CR200(X) has one analog voltage range of 0 to 2.5 volts. The resolution for a single A/D conversion is 0.6 millivolts.

4.2.4 Integration

Integration is used to reduce the noise included in a measurement. The CR200(X) uses a form of digital integration. It makes 10 A/D conversions and averages them for the result returned. The A/D conversions are made every 26 microseconds.
Averaging will also reduce signal noise from the sensor such as when water level measured with a pressure transducer is changing because of pressure fluctuations caused by wind.
Averaging also has an effect on the resolution. The resolution seen in the numerical result is the resolution of a single A/D conversion (0.6 mV) divided by the number of A/D conversions (10).
40
Section 4. Sensor Support

4.2.5 Self-Calibration

A calibration measurement to measure the ground offset is made at the beginning of each measurement instruction that includes a voltage measurement. This calibration takes about 400 microseconds. Only one calibration measurement is made per instruction regardless of the number of reps.
The battery voltage is checked every 8 seconds to ensure it is within the allowable range.

4.3 Bridge Resistance Measurements

Many sensors detect phenomena by way of change in a resistive circuit. Thermistors, strain gages, and position potentiometers are examples. Resistance measurements are special case voltage measurements. By supplying a precise, known voltage to a resistive circuit, then measuring the returning voltage, resistance can be calculated.
Two bridge measurement instructions are included in the CR200(X), ExDelSE () and Therm109 (). ExDelSE () is used with sensors that have a simple half bridge circuit. Therm109 () is used with Campbell Scientific’s 109-L thermistor probe. Sensors with bridge circuits that require a differential voltage measurement, such as full bridge or 3-wire half bridge, cannot be measured with the CR200(X).
FIGURE. Half Bridge Circuit Used with ExDelSE (p. 41) shows the circuit that
is typically measured with ExDelSE (). In the diagram. Rs is normally the sensor and Rf is normally a precision fixed (static) resistor. Vx is the excitation voltage (either 2500 or 5000 mV) and V1 is the voltage (mV) measured by the analog input channel.
Calculating the resistance of a sensor that is one of the legs of a resistive bridge requires additional processing following the bridge measurement instruction.
FIGURE. Half Bridge Circuit Used with ExDelSE (p. 41) lists the schematics of
a typical half bridge configuration and the calculations necessary to compute the resistance of any single resistor, provided the value of the other resistor in the bridge circuit is known.
Figure 28: Voltage Excitation Bridge Circuit
41
Section 4. Sensor Support

4.3.1 Measurements Requiring AC Excitation

4.4 Pulse Count Measurement

Some resistive sensors require AC Excitation. These include electrolytic tilt sensors, soil moisture blocks, water conductivity sensors, and wetness sensing grids. The use of DC excitation in these sensors can result in polarization, which will cause erroneous measurement, shift calibration, or lead to rapid sensor decay.
Other sensors, e.g., LVDTs (Linear Variable Differential Transformer), require and AC excitation because they rely on inductive coupling to provide a signal. DC excitation will provide no output.
CR200(X) bridge measurements cannot reverse excitation polarity to provide AC excitation and avoid ion polarization. Sensors requiring AC excitation should not be used with the CR200(X).
Other Campbell Scientific dataloggers (e.g. CR800 series, CR1000, CR3000) are compatible with sensors that require AC excitation.
FIGURE. Switch Closure Pulse Sensor p. 42 is a generalized schematic showing
connection of a pulse sensor to the CR200(X). The CR200(X) features two dedicated pulse input channels, P_SW and P_LL, and two digital I/O channels, C1and C2, for measuring pulse output sensors. Activated by the PulseCount () instruction, dedicated 16-bit counters on P_SW, P_LL, C1 and C2 are used to accumulate all counts over the user specified scan interval. The value which is output for each scan is the difference in the last known counter value and the new counter value. Since the last count is maintained for each scan, even if the counter rolls over between scans the correct count will be recorded. If the time between scans is such that the counter exceeds 65,536 pulses during a scan, then the counter will roll over twice resulting is an erroneous measurement. PulseCount () instruction parameters specify the pulse input type, channel used, and pulse output option.
Note: The PulseCount instruction must be executed once before the pulse or control port is ready for input. This may be of particular concern for programs with long scan intervals. For example, the PulseCount () instruction will not yield a valid output until the turn of the second hour if the PulseCount () instruction is used within a program with a scan interval of 1 hour.
42
Figure 29: Switch Closure Pulse Sensor
Section 4. Sensor Support
Note: The PulseCount () instruction should not be used in a conditional statement or subroutine. To ensure all pulses are detected, it must be executed each scan.
Execution of PulseCount () within a scan involves determining the accumulated counts in each dedicated 16-bit counter since execution of the last PulseCount (). PulseCount () parameter (POption) determines if the output is in counts (POption = 0) or frequency (POption = 1). Counts are the preferred output option for measuring number of tips from a tipping bucket rain gage, or the number of times a door opens. Many pulse sensors, such as anemometers and flow meters, are calibrated in terms of frequency (Hz or counts / second), and are usually measured with the frequency option.
Resolution of the pulse counters is one count. Resolution of frequency is (1/scan interval). For example, the frequency resolution of PulseCount() returning a result every 1 second is 1 Hz. The resultant measurement will bounce around by the resolution. For example, if you are scanning a 2.5 Hz input once a second, in some intervals there will be 2 counts and in some 3. If the pulse measurement is averaged, the correct value will be the result.
Accuracy is limited by a small scan interval error of ±(3 ppm of scan interval + 10 µs) plus the measurement resolution error of ± 1 Hz. The sum is essentially ± 1 Hz. Extending a 1 second measurement interval to 10 seconds, either by increasing the scan interval or by averaging, improves the resulting frequency resolution from 1 Hz to 0.1 Hz. Averaging can be accomplished by the Average () instruction or by computing a running or spatial average through programming.

4.4.1 Pulse input Channels

Read More! Review pulse counter specifications p. 35. Review pulse counter programming in CRBASIC Help for the PulseCount () instruction.
43
Section 4. Sensor Support
FIGURE. Pulse Input Types (p. 7) illustrates pulse input types measured by the
CR200(X). Dedicated pulse input channel P_SW can be configured to read high- frequency pulses or switch closure, while P_LL can be configured to read a low-level AC signal. With a 100 kOhm pull-up resistor added to the wiring panel P_LL, C1, or C2 can measure pulse input signals (See Pulse Input (P_SW p. 44).
Figure 30: Pulse Input Types
4.4.1.1 Pulse Input (P_SW)
Internal hardware routes high-frequency pulse to an inverting CMOS input buffer with input hysteresis. The CMOS input buffer is guaranteed to be an
output zero level with its input ≥ 2.7 V, and guaranteed to be an output one with its input ≤ 0.9 V. An RC input filter with approximately a 1 µs time constant
precedes the inverting CMOS input buffer, resulting in an amplitude reduction of high frequency signals between the P_SW terminal block and the inverting CMOS input buffer as illustrated in FIGURE. Amplitude reduction of pulse­count waveform. For a 0 to 5 Volt square wave applied to P_SW, the maximum frequency that can be counted in pulse input mode is approximately 1 kHz.
44
Figure 31: Amplitude Reduction of Pulse-Count Waveform (before and
after 1 ms time constant filter)
When a pulse channel is configured for pulse input mode, an internal 100 kΩ pull-up resistor to +5 Volt on the P_SW input is automatically employed. This pull-up resistor accommodates open-collector (open-drain) output devices for high-frequency input. An external 100 kΩ pull-up resistor connecting Battery+ to P_LL, C1, or C2 must be added to perform pulse counting on any of those channels (See Multiple Switch Closure Measurements p. 112).
The maximum input voltage on P_SW is 4 volts. For C1 and C2 the maximum input voltage is 6.5 volts.
4.4.1.2 Low-Level AC (P_LL)
Rotating magnetic pickup sensors commonly generate AC output voltages ranging from millivolts at low rotational speeds to several volts at high rotational speeds. Channel P_LL contains internal signal conditioning hardware for measuring low-level AC output sensors. P_LL measure signals ranging from 20 mV RMS (±28 mV peak) to 14 V RMS (±20 V peak). Internal AC coupling is incorporated in the low-level AC hardware to eliminate DC offset voltages of up to ±0.5 V.
Section 4. Sensor Support

4.4.2 Pulse Input on Digital I/O Channels C1–C2

Read More! Review digital I/O channel specifications in Specifications p. 35. Review pulse counter programming in CRBASIC Help for the PulseCount () instruction.
Digital I/O channels C1 – C2 can be configured to measure pulse input signals. Pulse input signals require external 100 kΩ pull-up resistors to be connected between Battery+ and the control ports. Maximum input voltage level is 6.5 V. If pulse inputs greater than +6.5 V need to be measured, external signal conditioning must employed. Contact Campbell Scientific for further information.
Low-level AC signals cannot be measured directly on channels C1 – C2.

4.5 Period Averaging Measurements

The CR200(X) can measure the period of a signal on any single-ended analog input channel (SE 1 - 5). The specified number of cycles are timed with a resolution of 70 ns, making the resolution of the period measurement 70 ns divided by the number of cycles chosen.
Cycles are counted as the input voltage transitions from less than 0.9 volts to more than 2.1 volts. The maximum input voltage must be less than 4 volts. The maximum frequency that can be detected is 150 kHz.
45
Section 4. Sensor Support

4.6 SDI-12 Recording

4.7 Cabling Effects on Measurements

4.7.1 Analog Sensor Cables

Read More! SDI-12 Sensor Support p. 112 and Serial Input / Output p. 105.
SDI-12 is a communications protocol developed to transmit digital data from smart sensors to data acquisition units. It is a simple protocol, requiring only a single communication wire. Typically, the data acquisition unit also supplies power (12V and ground) to the SDI-12 sensor. The CR200(X) is equipped with 1 SDI-12 channel and an SDI12Recorder () CRBASIC instruction.
Sensor cabling can have significant effects on sensor response and accuracy. This is usually only a concern with sensors acquired from manufacturers other than Campbell Scientific. Campbell Scientific sensors are engineered for optimal performance with factory installed cables.
Cable length in analog sensors is most likely to affect the signal settling time. For more information, see Signal Settling Time.

4.7.2 Pulse Sensors

Because of the long interval between switch closures in tipping bucket rain gages, appreciable capacitance can build up between wires in long cables. A built up charge can cause arcing when the switch closes, shortening switch life. As shown in FIGURE. Current Limiting Resistor in a Rain Gage Circuit (p. 46), a 100 ohm resistor is connected in series at the switch to prevents arcing. This resistor is installed on all rain gages currently sold by Campbell Scientific.
Figure 32: Current Limiting Resistor in a Tipping Bucket Rain Gage
Circuit
46

4.7.3 Serial Sensors

4.7.3.1 SDI-12 Sensors
The SDI-12 standard allows cable lengths of up to 200 feet. Campbell Scientific does not recommend SDI-12 sensor lead lengths greater than 200 feet; however, longer lead lengths can sometimes be accommodated by increasing the wire gage and/or powering the sensor with a second 12 vdc power supply placed near the sensor.
Section 4. Sensor Support
47
Section 4. Sensor Support
48

Section 5. Measurement and Control Peripherals

Peripheral devices expand the CR200(X) input / output capacity. Classes of peripherals are discussed below according to use.
Read More! For complete information on available measurement and control peripherals, go to APPENDIX. Sensors and Peripherals (Appendix p. 28),
www.campbellsci.com, or contact a Campbell Scientific applications engineer.

5.1 Control Output

Controlling power to an external device is a common function of the CR200(X). On-board control terminals are available for binary (on / off) control.
Many devices are conveniently controlled with the SW Battery (Switched 12 Volt) terminal on the CR200(X). Applications requiring more control channels or greater power sourcing capacity may be satisfied by using control ports C1 – C2 in conjunction with single-channel switching relays.

5.1.1 Binary Control

5.1.1.1 Digital I/O Ports
Each of 2 digital I/O ports (C1 - C2) can be configured as an output port and set low (0 V) or high (5 V) using the PortSet () or WriteIO () instructions. A digital I/O port is normally used to operate an external relay driver circuit because the port itself has limited drive capacity. Drive capacity is determined by the 5V supply and a 330 ohm output resistance. It is expressed as:
Vo = 4.9V - (330 ohms) * Io
Where Vo is the drive limit, and Io is the current required by the external device. FIGURE. Control Port Current Sourcing (p. 50) plots the relationship.
49
Section 5. Measurement and Control Peripherals
Figure 33: Control Port Current Sourcing
5.1.1.2 Switched 12 V Control
The SW Battery port can be set low (0 V) or high (12 V) using the SWBatt () instruction. The port is often used to control low power devices such as sensors that require 12 V during measurement. Current sourcing must be limited to 900 mA or less at 20°C. See TABLE. Current Sourcing Limits (p. 38).
A 12V switching circuit, driven by a digital I/O port, is also available from Campbell Scientific.
Note The SW Battery supply is unregulated and can supply up to 900 mA at 20°C. See TABLE. Current Sourcing Limits (p. 38). A resettable polymeric fuse protects against over-current. Reset is accomplished by removing the load or turning off the SW Battery for several seconds.
5.1.1.3 Relays and Relay Drivers
Compatible, inexpensive and reliable single-channel relay drivers for a wide range of loads are available from various electronic vendors such as Crydom, Newark, Mouser, etc.
5.1.1.4 Component Built Relays
50
FIGURE. Relay Driver Circuit with Relay (p. 51) shows a typical relay driver
circuit in conjunction with a coil driven relay which may be used to switch external power to some device. In this example, when the control port is set high, 12 V from the datalogger passes through the relay coil, closing the relay which completes the power circuit and turns on the fan.
Section 5. Measurement and Control Peripherals
In other applications it may be desirable to simply switch power to a device without going through a relay. FIGURE. Power Switching without Relay (p. 51) illustrates a circuit for switching external power to a device without using a relay. If the peripheral to be powered draws in excess of 75 mA at room temperature (limit of the 2N2907A medium power transistor), the use of a relay is required.
Figure 34: Relay Driver Circuit with Relay
Figure 35: Power Switching without Relay

5.2 Other Peripherals

5.2.1 TIMs

Terminal Input Modules (TIMs) are devices that provide simple measurement support circuits in a convenient package. TIMs include voltage dividers for cutting the output voltage of sensors to voltage levels compatible with the CR200(X), modules for completion of resistive bridges, and shunt modules for measurement of analog current sensors.
51
Section 5. Measurement and Control Peripherals
52

Section 6. CR200(X) Power Supply

Reliable power is the foundation of a reliable data acquisition system. When designing a power supply, consideration should be made regarding worst-case power requirements and environmental extremes.
Contact Campbell Scientific if assistance in selecting a power supply is needed, particularly with applications in extreme environments.

6.1 Power Requirement

The CR200(X) operates from a DC power supply with voltage ranging from 7 to 16 V. It is internally protected against accidental polarity reversal. Input voltages in excess of 18 V may damage the CR200(X) and/or power supply.
Caution The Battery + and Battery - terminals on the wiring panel are not regulated by the CR200(X); they obtain the same power directly the POWER IN terminal. When using the CR200(X) wiring panel to source power to other 12 V devices, be sure the power supply regulates the voltage within a the range specified by the manufacturer of the connected device.

6.2 Calculating Power Consumption

Read More! Power Requirements (p. 29).
System operating time for batteries can be determined by dividing the battery capacity (ampere-hours) by the average system current drain (amperes). The CR200(X) typically has an average current drain of less than 3 mA. The duty cycle of the radio will add to the current drain. Be sure to include the current used by any powered sensors when calculating power supply requirements.

6.3 Power Supplies

Complete power supply information is available in manual or brochure form at
www.campbellsci.com.

6.3.1 Battery Connection

Any clean, 7 to 16 VDC supply may be connected to the Battery + and Battery ­connector terminals on the front panel. When connecting external power to the CR200(X), insert the positive lead into the Battery + terminal. Insert the ground lead into the Battery - terminal.
53
Section 6. CR200(X) Power Supply
Auxiliary photovoltaic power sources may be used to maintain charge on lead acid batteries. Unregulated solar panels may be connected to Charge + and Charge – channels on the datalogger wiring panel.
When selecting a solar panel, a rule-of-thumb is that on a stormy overcast day the panel should provide enough charge to meet the system current drain (assume 10% of average annual global radiation, kW/m2). Specific site information, if available, could strongly influence the solar panel selection. For example, local effects such as mountain shadows, fog from valley inversion, snow, ice, leaves, birds, etc. shading the panel should be considered.
If help is needed in determining system power requirements, contact Campbell Scientific's Marketing Department.
54

Section 7. Grounding

Grounding the CR200(X) and its peripheral devices and sensors is critical in all applications. Proper grounding will ensure the maximum ESD (electrostatic discharge) protection and higher measurement accuracy.

7.1 ESD Protection

ESD (electrostatic discharge) can originate from several sources, the most common, and most destructive, being primary and secondary lightning strikes. Primary lightning strikes hit the datalogger or sensors directly. Secondary strikes induce a voltage in power lines or sensor wires.
The primary devices for protection against ESD are gas-discharge tubes (GDT). All critical inputs and outputs on the CR200(X) are protected with GDTs or transient voltage suppression diodes. GDTs fire at 150 V to allow current to be diverted to the earth ground lug. To be effective, the earth ground lug must be properly connected to earth (chassis) ground. The power ground and signal grounds have independent paths to the ground lug.
The 9-pin serial port is another path for transients. Communications paths such a telephone or short-haul modem lines should be provided spark gap protection at installation. Spark gap protection is often an option with these products, so it should always be requested when ordering. Spark gaps for these devices must be connected to either the earth ground lug, the enclosure ground, or to the earth (chassis) ground.
A good earth (chassis) ground will minimize damage to the datalogger and sensors by providing a low resistance path around the system to a point of low potential. Campbell Scientific recommends that all dataloggers be earth (chassis) grounded. All components of the system (dataloggers, sensors, external power supplies, mounts, housings, etc.) should be referenced to one common earth (chassis) ground.
In the field, at a minimum, a proper earth ground will consist of a 6 to 8 foot copper sheathed grounding rod driven into the earth and connected to the CR200(X) Ground Lug with a 12 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, consult the literature on lightning protection or contact a qualified lightning protection consultant.
In vehicle applications, the earth ground lug should be firmly attached to the vehicle chassis with 12 AWG wire or larger.
In laboratory applications, locating a stable earth ground is challenging, but still necessary. In older buildings, new AC receptacles on older AC wiring may indicate that a safety ground exists when in fact the socket is not grounded. If a safety ground does exist, it is good practice to verify that it carries no current. If the integrity of the AC power ground is in doubt, also ground the system through the buildings, plumbing or another connection to earth ground.
55
Section 7. Grounding

7.1.1 Lightning Protection

The most common and destructive ESDs 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 available, Campbell Scientific has for many years employed a simple and inexpensive design that protects most systems in most circumstances. It is, however, not infallible.
Note Lightning strikes may damage or destroy the CR200(X) and associated sensors and power supplies.
In addition to protections discussed in ESD Protection (p. 55), use of a simple lightning rod and low-resistance path to earth ground is adequate protection in many installations. A lightning rod serves two purposes. Primarily, it serves as a preferred strike point. Secondarily, it dissipates charge, reducing the chance of a lightning strike. FIGURE. Lightning Protection Scheme (p. 57) shows a simple lightning protection scheme utilizing a lightning rod, metal mast, heavy gage ground wire, and ground rod to direct damaging current away from the CR200(X).
56
Section 7. Grounding
Figure 36: Lightning Protection Scheme

7.2 Single-Ended Measurement Reference

Low-level single-ended voltage measurements are sensitive to ground potential fluctuations. Although the CR200(X) is not sensitive enough for low-level measurements and ground potential fluctuations are not usually a problem, the grounding scheme in the CR200(X) has been designed to eliminate ground potential fluctuations due to changing return currents from SW Battery, excitation channels, and the control ports. This is accomplished by utilizing separate signal and shield grounds ( advantage of this design, observe the following grounding rule:
Note Always connect a device's ground next to the active terminal associated
with that ground. Several ground wires can be connected to the same ground terminal.
) and power grounds (G). To take
57
Section 7. Grounding
Examples:
Connect grounds associated with SW Battery, VX1 (EX1), VX2 (EX2), C1,
and C2 to G terminals.
Connect the low side of single-ended sensors to the nearest (
the analog input terminal blocks.
Connect shield wires to the nearest (
terminal blocks.
) terminal on the analog input
) terminal on
58

Section 8. CR200(X) Configuration

The CR200(X) may require changes to factory default settings depending on the application. Most settings concern telecommunications between the CR200(X) and a network or PC.
Note The CR200(X) is shipped factory ready with all settings and firmware necessary to communicate with a PC via RS-232 and to accept and execute user application programs.
Prior to running DevConfig, connect a serial cable from the computer COM port to the RS-232 on the datalogger as shown in Figure. Power and RS-232
Connections p. 11.

8.1 DevConfig

DevConfig (Device Configuration Utility) is the preferred tool for configuring the CR200(X). It is made available as part of LoggerNet, PC400, and at
www.campbellsci.com.
Features of DevConfig include:
Communicates with devices via direct RS-232 only.
Sends operating systems to supported device types.
Sets datalogger clocks and sends program files to dataloggers.
Identifies operating system types and versions.
Provides a reporting facility wherein a summary of the current
configuration of a device can be shown, printed or saved to a file. The file can be used to restore settings, or set settings in like devices.
Provides a terminal emulator useful in configuring devices not directly
supported by DevConfig's graphical user interface.
Shows Help as prompts and explanations. Help for the appropriate settings
for a particular device can also be found in the user's manual for that device.
Updates from Campbell Scientific's web site.
As shown in FIGURE. DevConfig CR200(X) Utility (p. 60), the DevConfig window is divided into two main sections: the device selection panel on the left side and tabs on the right side. After choosing a device on the left, choose from the list of the serial ports (COM1, COM2, etc.) installed on the PC. A selection of baud rates is offered only if the device supports more than one baud rate. The page for each device presents instructions to set up the device to communicate with DevConfig. Different device types offer one or more tabs on the right.
59
Section 8. CR200(X) Configuration
Figure 37: DevConfig Utility

8.2 Sending the Operating System

The CR200(X) is shipped with the operating system pre-loaded. However, OS updates are made available at www.campbellsci.com and can be sent to the CR200(X).
Since sending an OS to the CR200(X) resets memory, data loss will certainly occur. Depending on several factors, the CR200(X) may also become incapacitated for a time. Consider the following before updating the OS.
1. Is sending the OS necessary to correct a critical problem? -- If not,
consider waiting until a scheduled maintenance visit to the site.
2. Is the site conveniently accessible such that a site visit can be
undertaken to correct a problem of reset settings without excessive expense?
If the OS must be sent, and the site is difficult or expensive to access, try the OS download procedure on an identically programmed, more conveniently located datalogger.

8.2.1 Sending OS with DevConfig

FIGURE. DevConfig OS Download Window (p. 61) and FIGURE. Dialog Box Confirming OS Download (p. 61) show DevConfig windows displayed during
the OS download process.
60
Caution Sending an operating system with DevConfig will erase all existing data and reset all settings to factory defaults.
Section 8. CR200(X) Configuration
Figure 38: DevConfig OS Download Window
Text in the Send OS tab lists instructions for sending an operating system to the CR200(X).
When the Start button is clicked, DevConfig offers a file open dialog box that prompts for the operating system file (*.obj file). When the CR200(X) is powered-up, DevConfig starts to send the operating system.
When the operating system has been sent, a confirming message dialog box.
Figure 39: Dialog Box Confirming OS Download
61
Section 8. CR200(X) Configuration
The information in the dialog helps to corroborate the signature of the operating system sent.

8.3 Settings

8.3.1 Settings via DevConfig

The CR200(X) has a number of properties, referred to as "settings", some of which are specific to the PakBus® communications protocol.
Read More! PakBus® is discussed in PakBus® Overview (p. 133
) and the
PakBus® Networking Guide available at www.campbellsci.com.
DevConfig | Settings Editor tab provides access to most PakBus® settings, however, the DevConfig | Deployment tab makes configuring most of these settings easier.
62
Figure 40: DevConfig Settings Editor
As shown in FIGURE. DevConfig Settings Editor (p. 62), the top of the Settings Editor is a grid that allows the user to view and edit the settings for the device. The grid is divided into two columns with the setting name appearing in the left hand column and the setting value appearing in the right hand column. Change the currently selected cell with the mouse or by using up-arrow and down-arrow keys as well as the Page-Up and Page-Down keys. When clicking in the setting names column, the value cell associated with that name will automatically be made active. Edit a setting by selecting the value, pressing the F2 key or by
Section 8. CR200(X) Configuration
double clicking on a value cell with the mouse. The grid will not allow read­only settings to be edited.
The bottom of the Settings Editor displays help for the setting that has focus on the top of the screen.
Once a setting is changed, click Apply or Cancel. These buttons will only become enabled after a setting has been changed. If the device accepts the settings, a configuration summary dialogue is shown (FIGURE. Summary of
CR200(X) Configuration p. 63) that gives the user a chance to save and print the
settings for the device.
Figure 41: Summary of CR200(X) Configuration
Clicking the Factory Defaults button on the Settings Editor will send a command to the device to revert to its factory default settings. The reverted values will not take effect until the final changes have been applied. This button will remain disabled if the device does not support the DevConfig protocol messages.
Clicking Save on the summary screen will save the configuration to an XML file. This file can be used to load a saved configuration back into a device by clicking Read File and Apply.
63
Section 8. CR200(X) Configuration
8.3.1.1 Deployment Tab
Figure 42: DevConfig Deployment Tab
As shown in FIGURE. DevConfig Deployment Tab p. 64, the Deployment tab allows the user to configure the datalogger prior to deploying it. Deployment tab settings can also be accessed through the Setting Editor tab and the Status table.
The CR200(X) default PakBus address is 1. Unless the CR200(X) is used in a network, there may be no need to change the PakBus address or any other default setting.
To change the PakBus address, use the up and down arrows next to the PakBus Address field or key in the desired number (e.g., 5) and click the Apply button.
The Spread Spectrum radios in the CR200(X) series, and in the RF401, have address, frequency, and power settings. These addresses are not PakBus addresses but an address the radio encodes in its message. For radios in a PakBus network to talk to each other the address and frequency settings must be the same in ALL radios.
To change radio settings, use the up and down arrows or drop-down menus next to the field of interest and click the Apply button when finished.
64
Hop Sequence specifies the hopping sequence that will be used for the
built-in radio. Spread Spectrum radios have a band of frequencies that they use. The radios “hop” from one frequency to another within this band, allowing multiple sets of radios to communicate at the same time without interfering with each other. This value should be set to match the Hop
Section 8. CR200(X) Configuration
Sequence value of the RF400 series base station used to communicate with the CR200(X) so they can contact each other.
Network specifies the radio network address of the built-in radio which is
combined with the radio address and sent as part of a packet header with each message. This value should be set to match the network address of the RF400 series base station used to communicate with the CR200(X).
Address specifies the address of the built-in radio which is combined with
the network value and sent as part of a packet header with each message. This value should be set to match the address of the RF400 series base station used to communicate with the CR200(X).
Power Mode specifies the power wait state that will be set in the built-in
radio and how much power the CR200(X) radio consumes from its power supply. This value should be consistent with the RF400 series base station used to communicate with the CR200(X).
RF Protocol identifies the radio protocol that will be used for the
CR200(X). For networks that include older CR205 and RF400 operating systems this will be Transparent. If no devices with older operating systems are present in the network PakBus Aware should be used.
Help is displayed at the bottom of the Deployment tab. When finished,
Apply the settings to the datalogger. The Summary window will appear. Save or Print the settings to archive or to use as a template for another datalogger.
Cancel causes the datalogger to ignore the changes. Read File provides the
opportunity to load settings saved previously from this or another similar datalogger. Changes loaded from a file will not be written to the datalogger until Apply is clicked.
8.3.1.2 Logger Control Tab
Figure 43: DevConfig Logger Control Tab
65
Section 8. CR200(X) Configuration
Clocks in the PC and CR200(X) are checked every second and the
Current Program displays the current program known to be running in the
The Last Compiled field displays the time when the currently running
Last Compile Results shows the compile results string as reported by the
The Send Program button presents an open file dialog from which to select
difference displayed. The System Clock Setting allows entering what offset, if any, to use with respect to standard time (Local Daylight Time or UTC, Greenwich mean time). The value selected for this control is remembered between sessions. Clicking the Set Clock button will synchronize the station clock to the current computer system time.
datalogger. This value is empty if there is no current program.
program was last compiled by the datalogger. As with the Current Program field, this value is read from the datalogger if it is available.
datalogger.
a program file to be sent to the datalogger. The field above the button is updated as the send operation progresses. When the program has been sent the Current Program, Last Compiled, and Last Compile Results fields are filled in.

8.3.2 Settings via CRBASIC

Some variables in the status table can be requested or set during program execution using the CRBASIC SetStatus () command. Entries can be requested or set by setting a Public or Dim variable equivalent to the status table entry, as can be done with variables in any data table. For example, to set a variable, x, equal to a status table entry, the syntax is,
x = Status.StatusTableEntry
Careful programming is required when changing settings via CRBASIC to ensure users are not inadvertently blocked from communicating with the CR200(X), the remedy for which may be a site visit.

8.3.3 Settings via Terminal Emulator

The CR200(X) has a simple terminal interface that can be accessed with a PC running a terminal emulator such as those available in PC200, PC400, or LoggerNet.
Terminal mode is entered while the PC is in telecommunications with the datalogger through a terminal emulator program. It is easily accessed through Campbell Scientific datalogger support software, but is accessible with terminal emulator programs such as Windows Hyperterminal. Datalogger keyboards and displays cannot be used.
66
The terminal emulator is accessed by navigating to the Datalogger menu in PC200W, the Datalogger menu in the Connect screen of LoggerNet, or the Tools menu in PC400. A serial cable must be connected between the computer/terminal and the CR200(X) in order to establish communications.
Section 8. CR200(X) Configuration
The CR200(X) will time out and exit the terminal mode if it does not receive a command within 12 seconds.
Enter a command by pressing the command followed by the carriage return. The commands are:
Commands Action (what returns)
A Trap Code 16 Information
1 Get clock
2 Set clock (after setting clock, exits terminal mode)
3 Status codes
4 Status table
5 Public table (real time values)
6 Most recent record from user defined table 1
7 Most recent record from user defined table 2
8 Most recent record from user defined table 3
9 Most recent record from user defined table 4
SDI12 Goes into the SDI-12 terminal mode and remains there
"OK" = memory ok "2005-7-14 13:56:6=16" = memory failure, 16 denotes trap code 16, date/time is when it occurred.
NOTE: When a trap code 16 happens, the datalogger suspends running the program and the red LED flashes twice every scan interval. A trap code of 16 means that the datalogger’s memory needs to be replaced.

8.3.4 Durable Settings

Many CR200(X) settings can be changed remotely over a telecommunications link either directly or as part of the CRBASIC program. This convenience comes with the risk of inadvertently changing settings and disabling communications. Such an instance will likely require an on-site visit to correct the problem. For example, digital cell modems are often controlled by a switched 12 Volt (SW Battery) channel. SW Battery is normally off, so, if the program controlling SW Battery is disabled, such as by replacing it with a program that neglects SW Battery control, the cell modem is switched off and the remote CR200(X) drops out of telecommunications.
67
Section 8. CR200(X) Configuration
68

Section 9. Programming

'Declaration of variables starts here. Public Start(6) 'Declare the start time array

9.1 Inserting Comments into Program

Comments are non-functioning text placed within the body of a program to document or clarify program algorithms.
As shown in CRBASIC EXAMPLE. Inserting Comments (p. 69), comments are inserted into a program by preceding the comment with a single quote ('). Comments can be entered either as independent lines or following CR200(X) code. When the CR200(X) compiler sees a single quote ('), it ignores the rest of the line.
CRBASIC EXAMPLE 1. Inserting Comments

9.2 Sending Programs

The CR200(X) requires a program be sent to its memory to direct measurement, processing, and data storage operations. Programs are sent with LoggerNet / PC400 / RTDAQ / PC200W datalogger support software.
Programs can also be sent from Device Configuration Utility (DevConfig). A good practice is to always retrieve data from the CR200(X) before sending a program, otherwise, data may be lost.
The CR200(X) does not have an on-board compiler to create the binary (.BIN) program file required by the datalogger. Instead, the datalogger support software creates a binary file using the appropriate compiler. The compiler is chosen to match the version of operating system found in the CR200(X) and a BIN file with the same filename as the selected CR2 file is created and sent to the datalogger.
It is important that the compiler used match the operating system version in the datalogger. If a different compiler is used, the program send will fail. Compilers are typically stored at C:\Campbellsci\Lib\CR200(X)Compilers.
The most current CR200(X) operating system along with compiler and CRBasic Editor support files may be obtained at www.campbellsci.com/downloads.

9.3 Writing Programs

Programs are created with either Short Cut or CRBASIC Editor. Short Cut is available at no charge at www.campbellsci.com. CRBASIC Editor is a program
69
Section 9. Programming

9.3.1 Short Cut Editor and Program Generator

9.3.2 CRBASIC Editor

in the LoggerNet / PC400 datalogger support software suites. Programs can be up to 19.6 KBytes in size although typical programs are smaller.
Short Cut is easy-to-use menu-driven software that presents the user with lists of predefined measurement, processing, and control algorithms from which to choose. The user makes choices and Short Cut writes the CRBASIC code required to perform the tasks. Short Cut creates a wiring diagram to simplify connection of sensors and external devices. Quickstart Tutorial (p. 3) works through a measurement example using Short Cut.
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.
CR200(X) application programs are written in a variation of BASIC (Beginner's All-purpose Symbolic Instruction Code) computer language, CRBASIC (Campbell Recorder BASIC). CRBASIC Editor is a text editor that facilitates creation and modification of the ASCII text file that constitutes the CR200(X) application program. CRBASIC Editor is available as part of LoggerNet / PC400 / RTDAQ datalogger support software packages.
Fundamental elements of CRBASIC include:
Variables - named packets of CR200(X) memory into which are stored
values that normally vary during program execution. Values are typically the result of measurements and processing. Variables are given an alphanumeric name and can be dimensioned into arrays of related data.
Constants - discrete packets of CR200(X) memory into which are stored
specific values that do not vary during program executions. Constants are given alphanumeric names and assigned values at the beginning declarations of a CRBASIC program.
Note Keywords and predefined constants are reserved for internal CR200(X) use. If a user programmed variable happens to be a keyword or predefined constant, a runtime or compile error will occur. To correct the error, simply change the variable name by adding or deleting one or more letters, numbers, or the underscore (_) from the variable name, then recompile and resend the program. CRBASIC Help provides a list of keywords and pre-defined constants.
70
Common instructions - Instructions and operators used in most BASIC
languages, including program control statements, and logic and mathematical operators.
Special instructions - Instructions unique to CRBASIC, including
measurement instructions that access measurement channels, and
processing instructions that compress many common calculations used in
Public FlagInt
EndTable
BeginProg
FlagInt = FlagInt + 2 ^ (I - 1)
EndIf
EndProg
CR200(X) dataloggers.
These four elements must be properly placed within the program structure.

9.4 Numerical Formats

Four numerical formats are supported by CRBASIC. Most common is the use of base 10 numbers. Scientific notation, binary, and hexadecimal formats may also be used, as shown in TABLE. Formats for Entering Numbers in CRBASIC (p.
71). Only standard base 10 notation is supported by Campbell Scientific hardware and software displays.
Table 5. Formats for Entering Numbers in CRBASIC
Format Example Base 10 Equivalent Value
Standard 6.832 6.832
Scientific notation 5.67E-8
Binary &B1101 11
Hexadecimal &HFF 255
5.67X10
Section 9. Programming
-8
Binary format is useful when loading the status (1 = high, 0 = low) of multiple flags or ports into a single variable, e.g., storing the binary number &B11100000 preserves the status of flags 8 through 1. In this case, flags 1 - 5 are low, 6 - 8 are high. CRBASIC EXAMPLE. Load Binary Information into a
Variable (p. 71) shows an algorithm that loads binary status of flags into a
LONG integer variable.
CRBASIC EXAMPLE 2. Load binary information into a single variable
Public Flag(8) Public I
DataTable (FlagOut,True,1000)
Sample (1,FlagInt)
Scan (1,Sec)
FlagInt = 0 For I = 1 To 8
Flag (I) = IIF (Flag(I)= 0,0,-1) If Flag(I) = true then
Next I CallTable FlagOut
NextScan
71
Section 9. Programming

9.5 Structure

TABLE. CRBASIC Program Structure (p. 72) delineates CRBASIC program
structure:
Table 6. CRBASIC Program Structure
Declarations Define datalogger memory usage. Declare constants,
Declare constants List fixed constants
Declare Public variables List / dimension variables viewable during program
Dimension variables List / dimension variables not viewable during program
Define Aliases Assign aliases to variables.
Define Units Assign engineering units to variable (optional). Units
Define data tables. Define stored data tables
Process/store trigger Set triggers when data should be stored. Triggers may
Table size Set the size of a data table
Processing of Data List data to be stored in the data table, e.g. samples,
Begin Program Begin Program defines the beginning of statements
Set scan interval The scan sets the interval for a series of measurements
Measurements Enter measurements to make
Processing Enter any additional processing
Call Data Table(s) Declared data tables must be called to process and
Initiate controls Check measurements and initiate controls if necessary
NextScan Loop back to Set Scan and wait for the next scan
End Program End Program defines the ending of statements defining
variables, aliases, units, and data tables.
execution
execution.
are strictly for documentation. The CR200(X) makes no use of Units nor checks Unit accuracy.
be a fixed interval, a condition, or both.
averages, maxima, minima, etc.
Processes or calculations repeated during program execution can be packaged in a subroutine and called when needed rather than repeating the code each time.
defining datalogger actions.
store data
datalogger actions.
72
CRBASIC EXAMPLE. Proper Program Structure (p. 73) demonstrates the
proper structure of a CRBASIC program.
CRBASIC EXAMPLE 3. Proper Program Structure
Section 9. Programming

9.6 Declarations I - Single-line Declarations

Public variables, Dim variables, Constants, Units, Aliases, Data Tables and Subroutines are declared at the beginning of a CRBASIC program. TABLE.
Rules for Names (p. 85) lists declaration names and allowed lengths

9.6.1 Variables

A variable is a packet of memory, given an alphanumeric name, through which pass measurements and processing results during program execution. Variables are declared either as Public or Dim at the discretion of the programmer. Public variables can be viewed through software numeric monitors. Dim variables cannot. Up to 128 public variables can be declared in a CR200(X) program and up to 48 public variables declared in a CR200 program.
73
Section 9. Programming
9.6.1.1 Arrays
Variable names can be up to 16 characters in length, but most variables should be no more than 12 characters long. This allows for the 4 additional characters that are added as a suffix to the variable name when it is output to a data table.
Variable names cannot start with a number or contain spaces or quote marks (“), but can contain numbers and underscores (_). Several variables can be declared on a single line, separated by commas:
Public RefTemp, AirTemp2, Batt_Volt
When a variable is declared, several variables of the same root name can also be declared. This is done by placing a suffix of "(x)" on the alphanumeric name, which creates an array of x number of variables that differ only by the incrementing number in the suffix. For example, rather than declaring four similar variables as follows,
Public TempC1
Public TempC2
Public TempC3
Public TempC4
simply declare a variable array as shown below:
Public TempC(4),
This creates in memory the four variables TempC(1), TempC(2), TempC(3), and TempC(4).
A variable array is useful in program operations that affect many variables in the same way. CRBASIC EXAMPLE. Using a Variable Array in Calculations (p.
74) shows program code using a variable array to reduce the amount of code required to convert four temperatures from Celsius degrees to Fahrenheit degrees.
In this example a For/Next structure with a changing 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. If an array element is not specifically referenced, e.g., TempC(), CRBASIC references only the first element of the array, TempC(1).
74
Public TempC(4)
BeginProg
EndProg
CRBASIC EXAMPLE 4. Using a variable array in calculations
Public TempF(4) Dim T
Scan (1,Sec,0,0)
Therm109 (TempC(),4,1,Ex1,1.0,0) For T = 1 To 4
TempF(T) = TempC(T) * 1.8 + 32
Next
NextScan
9.6.1.2 Dimensions
The CR200(X) cannot use multi-dimensioned arrays.
9.6.1.3 Data Types
Variables, calculations, and stored data use IEEE4 4-byte floating point, a binary format, with least significant bit first. Time is stored as integer seconds since midnight, the start of 1990, which is also a 4-byte number.
Section 9. Programming
9.6.1.4 Flags
CR200(X) IEEE4 Data
Word Size Range Resolution
4 bytes
±1.8 x 10-38 to
24 bits (about 7 digits)
±1.7 x 1038
Flags are a useful program control tool. While any variable can be used as a flag, variables named "Flag" works best because datalogger support software automatically adds variables call "Flag" to the Ports and Flags window. Because the CR200(X) does not support the Boolean data type, the IIF function may be used to distinguish between zero and non-zero values, effectively creating a Boolean value. The value of -1(all bits on) is defined as true and the value of zero (all bits off) is defined as false. CRBASIC EXAMPLE. Flag Declaration
and Use (p. 76) shows an example using a flag to initiate measurements.
75
Section 9. Programming
Public batt_volt
Public PTempC, PTempF
EndProg
CRBASIC EXAMPLE 5. Flag Declaration and Use
Public Flag
BeginProg
Scan (1,Sec)
Flag = IIF (Flag=0,0,-1) If Flag = true Then
Battery (batt_volt)
EndIf
NextScan
EndProg

9.6.2 Constants

CRBASIC EXAMPLE. Using the Const Declaration (p. 76) shows use of the
constant declaration. A constant can be declared at the beginning of a program to assign an alphanumeric name to be used in place of a value so the program can 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.
CRBASIC EXAMPLE 6. Using the Const Declaration
Const CtoF_Mult = 1.8 Const CtoF_Offset = 32
BeginProg
Scan (1,Sec,0,0)
Therm109 (PTempC,1,1,Ex1,1.0,0) PTempF = PTempC * CtoF_Mult + CtoF_Offset
NextScan
9.6.2.1 Predefined Constants
Note Using all uppercase for constant names may make them easier to recognize.
Several words are reserved for use by CRBASIC. These words cannot be used as variable or table names in a program. Predefined constants include some instruction names, as well as valid alphanumeric names for instruction parameters. In general, instruction names should not be used as variable, constant, or table names in a datalogger program, even if they are not specifically listed as a predefined constant. If a predefined constant, such as "Sub" is used as a variable in a program, an error similar to the following may be, but is not always, displayed at CRBASIC pre-compile.
Compile Failed! line 8: Sub is already is use as a predefined CONST.
76
TABLE. Predefined Constants and Reserved Words (p. 77) lists predefined
Public TempC(2)
constants.
Table 7. Predefined Constants and Reserved Words
Case Day DO FOR
FALSE Hr If Msec
min mv2500 mv5000 PROG
SCAN Select SUB Sec
TABLE TRUE Usec Until
EX1 EX2 While

9.6.3 Alias and Unit Declarations

A variable can be assigned a second name, or alias, by which it can be called throughout the program. Aliasing is particularly useful when using arrays. Arrays are powerful features in complex programs, but place the same appellation on a number of variables. The use of an alias allows the power of the array to be used with the clarity of unique names.
Section 9. Programming
Each variable can be assigned units to clarify the meaning. Units are not used elsewhere in programming, but rather add meaning to resultant data table headers.
CRBASIC EXAMPLE 7. Alias and Unit Declaration
Alias TempC(1)=AirTempC Alias TempC(2)=SoilTempC
Units TempC()=Deg_C
BeginProg
Scan (1,Sec)
Therm109 (TempC(),2,1,Ex1,1.0,0)
NextScan
EndProg

9.7 Declarations II - Declared Sequences

9.7.1 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:
77
Section 9. Programming
DataTable ()
Output Trigger Condition(s) Output Processing Instructions
EndTable
A data table is essentially a file that resides in CR200(X) 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 CR200(X)'s clock, or by an event, such as a high temperature. Up to 8 data tables can be created by the program for a CR200(X) (4 data tables for a CR200). The data tables may store individual measurements, individual calculated values, or summary data such as averages, maxima, or minima to data tables.
Each data table is associated with overhead information that becomes part of the ASCII file header (first few lines of the file) when data are downloaded to a PC. Overhead information includes:
table format
datalogger type and operating system version,
name of the CRBASIC program running in the datalogger
name of the data table (limited to 16 characters)
alphanumeric field names to attach at the head of data columns
This information is referred to as "table definitions."
TABLE. Typical Data Table (p. 79) shows a data file as it appears after the
associated data table has been downloaded from a CR200(X) programmed with the code in CRBASIC EXAMPLE. Definition and Use of a Data Table (p. 79). The data file consists of five or more lines. Each line consists of one or more fields. The first four lines constitute the file header. Subsequent lines contain data.
The first header line is the Environment Line. It consists of eight fields, listed in
TABLE. TOA5 Environment Line (p. 78).
Table 8. TOA5 Environment Line
Field Description Changed via
1 file type (always TOA5) No Change
2 station name DevConfig or Program
3 datalogger model No Change
4 datalogger serial number No Change
5 datalogger OS version Send New OS
6 datalogger program name Send New Program
7 datalogger program signature Send / Change Program
8 table name Change Program
78
Section 9. Programming
The second header line reports field names. This line consists of a set of comma-delimited strings that identify the name of individual fields as given in
the datalogger program. If the field is an element of an array, the name will be
followed by a comma separated list of subscripts within parentheses that identifies the array index. For example, a variable named values that is declared as an array of four elements in the datalogger program will be represented by four field names: values(1), values(2), values(3), and values(4). Scalar variables will not have array subscripts. There will be one value on this line for each
scalar value that is defined by the table. Default fieldnames are a combination
of the variable names (or alias) from which data are derived and a three letter suffix. The suffix is an abbreviation of the data process that output the data to storage. For example, “Avg” is the abbreviation for average. If the default fieldnames are not acceptable to the programmer, FieldNames () instruction can be used to customized fieldnames.
The third header line identifies engineering units for that field of data. These units are declared in the “Define Units” section of the CRBASIC program, as shown in CRBASIC EXAMPLE. Definition and Use of a Data Table (p. 79). Units are strictly for documentation.
Subsequent lines are observed data and associated record keeping. The first field being a timestamp, the second the record (data line) number.
Read More! See TABLE. Abbreviations of Names of Data Processes (p. 90
) for
a list of default field names.
Table 9. Typical Data Table
TOA5 CR200(X) CR2xx No_SN CR200(X).Std.01 Data.CR2 4098 OneMin
TIMESTAMP RECORD BattV_Min T109_C_Avg Rain_mm_Tot
TS RN Volts Deg C Mm
12/30/2010
12:59:00 PM 0 12.52359 -7.390147 0
12/30/2010
1:00:00 PM 1 12.56724 -6.412211 0
12/30/2010
1:01:00 PM 2 12.52695 -6.267832 0
12/30/2010
1:02:00 PM 3 12.56472 -6.298645 0
Min Avg Tot
79
Section 9. Programming
'Declare Variables
'Define Units
'Define Data Tables
DataTable (Table1,True,-1)
'Main Program
'109-L Thermistor measurements Temp_C:
EndProg
CRBASIC EXAMPLE 8. Definition and Use of a Data Table
Public Batt_Volt Public T109_C(2)
Units Batt_Volt=Volts Units T109_C(2)=Deg C
DataTable (OneMin,True,-1)
DataInterval (0,1,Min) Average (1,Batt_Volt,False) Average (2,T109_C(1),False)
EndTable
DataInterval (0,1440,Min) Minimum (1,Batt_Volt,False,False)
EndTable
BeginProg
Scan (5,Sec)
'Default Datalogger Battery Voltage measurement Batt_Volt: Battery (Batt_Volt)
Therm109(T109_C(),2,1,Ex1,1,0)
'Call Data Tables and Store Data CallTable (OneMin) CallTable (Table1)
NextScan
As shown in CRBASIC EXAMPLE. Definition and Use of a Data Table (p. 79), 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.
9.7.1.1 DataTable () and EndTable () Instructions
The DataTable instruction has three parameters: a user-specified alphanumeric name for the table (e.g., "OneMin"), a trigger condition (e.g., "True"), and the size to make the table in RAM (e.g., auto allocated).
80
Name-The table name can be any combination of numbers and letters up to
16 characters in length. The first character must be a letter.
Section 9. Programming
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 processing. Intermediate processing is controlled by the disable variable, DisableVar, which is a parameter in all output processing instructions (see
Output Processing Instructions (p. 81)).
Read More! TrigVar and DisableVar - Controlling Data Output and Output
Processing (p. 125) discusses the use of TrigVar and DisableVar in special
applications.
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 automatically allocated at the time the program compiles. Auto allocation is preferred in most applications since the CR200(X) sizes all tables such that they fill (and begin overwriting the oldest data) at about the same time. Approximately 2K bytes of extra data table space is allocated to minimize the possibility of new data over writing the oldest data in ring memory when support software collects the oldest data at the same time new data are written. These extra records are not reported in the Status Table and are not reported to the support software and so are not collected.
CRBASIC EXAMPLE. Definition and Use of a Data Table (p. 79) creates a data
table named "OneMin", stores data once a minute as defined by DataInterval (), and retains the most recent records in SRAM, up to the automatically allocated memory limit. DataRecordSize entries in the status table report allocated memory in terms of number of records the tables hold.
9.7.1.2 DataInterval () Instruction
DataInterval () instructs the CR200(X) to write data records at the specified interval. The interval is independent of the Scan () / NextScan interval; however, it must be a multiple of the Scan () / NextScan interval. The data interval must be at least one minute.
DataInterval does not override the trigger condition in the DataTable instruction. If the trigger is not set always true by entering a constant, it is a condition that must be met in addition to the time interval before data will be stored.
9.7.1.3 Output Processing Instructions
Data storage processing ("output processing") instructions determine what data are stored in the 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, e.g. the required interval has expired, processed values are stored ("output") in the data table. In CRBASIC
EXAMPLE. Definition and Use of a Data Table (p. 79), three averages are
stored.
81
Section 9. Programming
'Declare Variables and Units
'Define Data Tables
'Main Program
If Oscillator = 1
Consider the Average () instruction as an example of output processing instructions. Average () stores the average of a variable over the data storage output interval. Its parameters are:
Reps-number of elements in the variable array for which to calculate
averages. Reps is set to 1 to average Batt_Volt, and set to 2 to average 2 thermistor temperatures, both of which reside in the variable array "T109_C".
Source-variable array to average. Variable arrays Batt_Volt (an array of 1)
and T109_C() (an array of 2) are used.
DisableVar-controls whether or not a measurement or value is included in
an output processing function. A measurement or value will not be included
if the disable variable is true (≠ 0). For example, in the case of an Average
() output processing instruction, if, on a particular pass through the data table, the Average () disable variable true, the value resident in the variable to be averaged with not be included in the average. Program CRBASIC EXAMPLE. Use of the Disable Variable has "False" entered for the disable variable, so all readings are included in the averages; the average of variable "Oscillator" does not include samples occurring when Flag 1 is high, producing an average of 2, whereas, when Flag 1 is low (all samples used), an average of 1.5 is calculated.
Read More!
Output and Output Processing
use of TrigVar and DisableVar in special applications.
TrigVar and DisableVar - Controlling Data
CRBASIC EXAMPLE 9. Use of the Disable Variable
Public Oscillator Public Flag Public DisableVar
DataTable (OscAvgData,True,-1)
DataInterval (0,1,Min) Average (1,Oscillator,DisableVar)
EndTable
BeginProg
Scan (1,Sec)
'Reset and Increment Counter If Oscillator = 2 Then Oscillator = 0 Oscillator = Oscillator + 1
'Process and Control
(p. 125) discusses the
82
If Flag = True Then
EndProg
'Declare Variables and Units
EndSub
'Main Program
Call ConvertCtoF
NextScan
EndProg
DisableVar = True
End If
Else
DisableVar = False
EndIf
'Call Data Tables and Store Data CallTable (OscAvgData)
NextScan
Read More! For a complete list of output processing instructions, see Data
Storage Output Processing (p. 94).

9.7.2 Subroutines

Subroutines allow a section of code to be called by multiple processes in the main body of a program. Subroutines are defined before the main program body of a program. Program CRBASIC EXAMPLE. Use of a Subroutine p. 83 shows the use of a subroutine to repeatedly perform a calculation.
Section 9. Programming
CRBASIC EXAMPLE 10. Use of a Subroutine
Public Temp(4), I, Temp_F(4)
'Subroutine to convert temperature in degrees C to degrees F Sub ConvertCtoF
For I = 1 to 4
Temp_F = Temp(I)*1.8 + 32
Next I
BeginProg
Scan (1,Sec)
Therm109 (Temp(),4,1,Ex1,1.0,0) 'convert Temperatures to F using Subroutine:

9.8 Program Execution Timing

CR200(X) programs are built within a Scan () / NextScan structure, with only variable and data table declarations outside the Scan () / NextScan structure. In these programs, Scan () / NextScan creates an infinite loop, each periodic pass through the loop being synchronized to the CR200(X) clock. Scan () parameters allow modification of the period. As shown in CRBASIC EXAMPLE. BeginProg
/ Scan / NextScan / EndProg Syntax (p. 84) , aside from declarations, the
CRBASIC program may be relatively short.
83
Section 9. Programming
BeginProg
EndProg
ExciteV (1,mV5000))
Scan () determines how frequently instructions in the program are executed. Scan has two parameters:
Interval is the interval between scans.
Units is the time unit for the interval. Interval is 1sec <= Interval <= 1 day.
CRBASIC EXAMPLE 11. BeginProg / Scan / NextScan / EndProg Syntax
Scan (1,Sec)
Therm109 (TempC(),2,1,Ex1,1.0,0) CallTable Temp
NextScan

9.9 Instructions

In addition to BASIC syntax, additional instructions are included in CRBASIC to facilitate measurements and store data. CRBASIC Programming Instructions (p. 93) contains a comprehensive list of these instructions.

9.9.1 Measurement and Data Storage Processing

CRBASIC instructions have been created for making measurements and storing data. Measurement instructions set up CR200(X) hardware to make measurements and store results in variables. Data storage instructions process measurements into averages, maxima, minima, standard deviation, FFT, etc.
Each instruction is a keyword followed by a series of informational parameters needed to complete the procedure. For example, the instruction used to set an excitation channel to a specified value is:
ExciteV (ExChan,ExmV)
"ExciteV" is the keyword. Two parameters follow: ExChan, the excitation channel number to which the voltage should be applied; and ExmV, is the excitation, in millivolts, to apply to the sensor. The syntax for applying 5000 millivolts to a sensor through excitation channel number 1 is shown in
CRBASIC EXAMPLE. Measurement Instruction Syntax (p. 84).
CRBASIC EXAMPLE 12. Measurement Instruction Syntax
84

9.9.2 Parameter Types

Many instructions have parameters that allow different types of inputs. Common input type prompts are listed below. Allowed input types are specifically identified in the description of each instruction in CRBASIC Editor Help.
Constant, or Expression that evaluates as a constant
Variable
Variable or Array
Constant, Variable, or Expression
Constant, Variable, Array, or Expression
Name
Name or list of Names
Variable, or Expression
Variable, Array, or Expression
Section 9. Programming

9.9.3 Names in Parameters

TABLE. Rules for Names (p. 85) lists the maximum length and allowed
characters for the names for Variables, Arrays, Constants, etc. The CRBASIC Editor pre-compiler will identify names that are too long or improperly formatted.
Table 10. Rules for Names
Name for
Variable or Array 16 Letters A-Z, upper or lower case,
Constant 16
Units 10
Alias 16
Station Name 16
Data Table Name 16
Field name 16
Field Name Description
Maximum Length (number of characters)
58
Allowed characters
underscore "_", and numbers 0-9. The name must start with a letter. CRBASIC is not case sensitive
85
Section 9. Programming
'DataTable (Name, TrigVar, Size) DataTable (Temp, TC > 100, 5000)
Public Pressure(3), Mult(3), Offset(3)
BeginProg
EndProg

9.9.4 Expressions in Parameters

Read More! See Expressions (p. 87) for more information on expressions.
Many parameters allow the entry of expressions. If an expression is a comparison, it will return -1 if the comparison is true and 0 if it is false (Logical
Expressions (p. 88)). CRBASIC EXAMPLE. Use of Expressions in Parameters
(p. 86) shows an example of the use of expressions in parameters in the DataTable instruction, where the trigger condition is entered as an expression. Suppose the variable TC is a thermistor temperature:
CRBASIC EXAMPLE 13. Use of Expressions in Parameters
When the trigger is "TC > 100", a TC temperature > 100 will set the trigger to true and data is stored.

9.9.5 Arrays of Multipliers and Offsets

A single measurement instruction can measure a series of sensors and apply individual calibration factors to each sensor as shown in CRBASIC EXAMPLE.
Use of Arrays as Multipliers and Offsets (p. 86). Storing calibration factors in
variable arrays, and placing the array variables in the multiplier and offset parameters of the measurement instruction, makes this possible. The measurement instruction uses repetitions to implement this feature by stepping through the multiplier and offset arrays as it steps through the measurement input channels. If the multiplier and offset are not arrays, the same multiplier and offset are used for each repetition.
CRBASIC EXAMPLE 14. Use of Arrays as Multipliers and Offsets
DataTable (AvgPress,1,-1)
DataInterval (0,60,Min) Average (3,Pressure(),IEEE4,0)
EndTable
'Calibration Factors: Mult(1)=0.123 : Offset(1)=0.23 Mult(2)=0.115 : Offset(2)=0.234 Mult(3)=0.114 : Offset(3)=0.224
Scan (1,Sec)
'VoltSe instruction using array of multipliers and offsets: VoltSe (Pressure(),3,1,Mult(),Offset()) CallTable AvgPress
NextScan
86
Read More! More information is available in CRBASIC Editor Help topic "Multipliers and Offsets with Repetitions".

9.10 Expressions

An expression is a series of words, operators, or numbers that produce a value or result. Expressions are evaluated expression from left to right, with deference to precedence rules.
Two types of expressions, mathematical and programming, are used in CRBASIC. A useful property of expressions in CRBASIC is that they are equivalent to and often interchangeable with their results.
Consider the expressions:
x = (z * 1.8) + 32 (a mathematical expression)
If x = 23 then y = 5 (programming expression)
Section 9. Programming
The variable x can be omitted and the expressions combined and written as:
If (z * 1.8 + 32 = 23) then y = 5
Replacing the result with the expression should be done judiciously and with the realization that doing so may make program code more difficult to decipher.

9.10.1 Floating Point Arithmetic

Variables and calculations are performed internally in single precision IEEE4 4­byte floating point, a binary format.
Floating point arithmetic is common in many electronic computational systems, but it has pitfalls high-level programmers should be aware of. Several sources discuss floating point arithmetic thoroughly. One readily available source is the topic "Floating Point" at Wikipedia.org. In summary, CR200(X) programmers should consider at least the following:
Floating point numbers do not perfectly mimic real numbers.
Floating point arithmetic does not perfectly mimic true arithmetic.
Avoid use of equality in conditional statements. Use >= and <= instead. For
example, use "If X => Y, then do" rather than using, "If X = Y, then do".

9.10.2 Mathematical Operations

Mathematical operations are written out much as they are algebraically. For example, to convert Celsius temperature to Fahrenheit, the syntax is:
TempF = TempC * 1.8 + 32
87
Section 9. Programming
For I = 1 to 5
Next I
CRBASIC EXAMPLE. Use of Variable Arrays to conserve Code p. 88 shows
example code to convert five temperatures in a variable array from C to F:
CRBASIC EXAMPLE 15. Use of Variable Arrays to Conserve Code Space
TempC(I) = TempC(I) * 1.8 + 32

9.10.3 Logical Expressions

Measurements can indicate absence or presence of an event. For example, an RH measurement of 100% indicates a condensation event such as fog, rain, or dew. The CR200(X) can render events into binary form for further processing, i.e., events can either be TRUE, indicating the condition occurred or is occurring, or FALSE, indicating the condition has not yet occurred or is over.
Several words are commonly interchanged with True / False such as High /
Low, On / Off, Yes / No, Set / Reset, Trigger / Do Not Trigger. The CR200(X) understands only True / False or -1 / 0, however. The CR200(X) represents "true" with "-1" because AND / OR operators are the same for logical statements and binary bitwise comparisons.
In the binary number system internal to the CR200(X), "-1" is expressed with
all bits equal to 1 (11111111). "0" has all bits equal to 0 (00000000). When -1 is ANDed with any other number, the result is the other number. This ensures that if the other number is non-zero (true), the result is non-zero.
Using TRUE or FALSE conditions with logic operators such as AND and OR, logical expressions can be encoded into a CR200(X) to perform three general logic functions, facilitating conditional processing and control applications.
1. Evaluate an expression, then take one path or action if the expression is
true (= -1), and / or another path or action if the expression is false (=
0).
2. Evaluate multiple expressions linked with AND or OR.
3. Evaluate multiple and / or links.
88
Loading...