Page 1
CR9000 Measurement and Control System Revision: 5/05 C o p y r i g h t ( c ) 1 9 9 5 - 2 0 0 5 C a m p b e l l S c i e n t i f i c ,...
Page 2
Warranty and Assistance The CR9000 MEASUREMENT AND CONTROL SYSTEM is warranted by CAMPBELL SCIENTIFIC, INC. to be free from defects in materials and workmanship under normal use and service for thirty-six (36) months from date of shipment unless specified otherwise. Batteries have no warranty.
1.4.2 Effect on Measurements: Common Mode Range ...... 1-9 1.5 Use of Digital Control Ports for Switching Relays......1-10 2. Data Storage and Retrieval ........2-1 2.1 Data Storage in CR9000 ............... 2-1 2.1.1 Internal Static Ram..............2-1 2.1.2 Internal Flash Memory..............2-1 2.1.3 9080 PAM Module —...
Page 4
2.4.2 TOA5 ASCII File Format ............2-11 2.4.3 TOB1 Binary File Format ............2-12 2.4.4 TOB2 Binary File Format ............2-12 3. CR9000 Measurement Details......... 3-1 3.1 Measurements using the CR9041 A/D..........3-1 3.1.1 Analog Voltage Measurement Sequence ........3-1 3.1.2 Single Ended and Differential Voltage Measurements ....
Page 5
CR9000 Table of Contents 7. Measurement Instructions ........7-1 7.1 Voltage Measurements ................. 7-3 7.2 Thermocouple Measurements............... 7-3 7.3 Half Bridges..................7-6 7.4 Full Bridges ..................7-9 7.5 Excitation/Continuous Analog Output ..........7-10 7.6 Self Measurements................7-11 7.7 Peripheral Devices ................7-12 7.8 Digital I/O...................
Page 6
CR9000 Table of Contents This is a blank page.
(CR9052E filter module, or the CR9058E isolation module). The CR9000 Base System includes CPU, power supply, and A/D modules. Up to nine I/O modules are inserted to configure a system for specific applications.
Page 8
The CR9011 has a relay that allows shutting off power under program control. The Power Up inputs allow an external signal to awaken the CR9000 from a powered down state (PowerOff, Section 9). When the CR9000 is in this power off state the ON Off switch is in the on position but the internal relay is open.
Analog Input Module. Each input channel is fault-protected so as to permit over-voltages between +50 V and –40 V without corruption of measurements on other input channels. All the CR9051E input channels become open switches when the CR9000 is powered off. The CR9051E is recommended OV-3...
Page 10
CR9000 Overview over the CR9050E for applications where fault voltages beyond ±9 V could come in contact with the inputs, or when the CR9000 could be powered off while still connected to sensors that have power applied to them. CR9050EC...
Page 11
CR9000 Overview SHORT SHORT SHORT SHORT SHORT SHORT OPEN OPEN OPEN OPEN OPEN OPEN CH 1 CH 2 CH 3 CH 4 CH 5 CH 6 CR9052IEPE MADE IN USA FIGURE OV1-8. CR9052IEPE CR9058E Isolation Module The CR9058E is a 10 channel, differential input isolation module. Each channel has a 24 bit A/D converter which supplies input isolation for up to ±60...
Page 12
CR9000 Overview 9055 50V ANALOG INPUT MADE IN USA FIGURE OV1-10. CR9055 CR9060 Excitation Module The CR9060 Excitation Module has six continuous analog outputs with individual digital-to-analog converters for PID Algorithm, waveform generation, and excitation for bridge measurements. Ten switched excitation channels provide precision voltages for bridge measurements.
Page 13
CR9000 Overview DIGITAL I/O LOW LEVEL AC SWITCH CLOSURRE 12 13 15 16 9070 COUNTER & DIGITAL I O MADE IN USA FIGURE OV1-12. CR9070 CR9071E Counter and Digital I/O Module Features 12 channels capable of high-level (5 V square wave) pulse counting at frequencies up to 1 MHz.
FIGURE OV1-14. CR9080 OV1.3 Communication Interfaces TL925 RS232-TLINK Interface The TL925 CR9000 to Computer Interface converts RS232 signals from the computer into a transputer link for the CR9000. The TLINK cable can be up to 30 meters long. Logan Utah TL925...
OV2. Memory and Programming Concepts OV2.1 Memory The CR9031 CPU Module in the CR9000 base system has 2MB static RAM and 2MB Flash EEPROM. The static RAM allows fast read write cycles (150 ηs). The Flash EEPROM is much slower to write to (15 µs minimum) but it retains its information when power is shut off.
Stores data OV2.3 Data Tables The CR9000 can store individual measurements or it may use its extensive processing capabilities to calculate averages, maxima, minima, histograms, FFTs, etc., on periodic or conditional intervals. Data are stored in tables such as listed in Table OV2-1.
This overview points out the main PC9000 functions and where to find them. PC9000 has extensive on-line help to guide the user in its operation. Install PC9000 to get the details. A CR9000 is not necessary to try out the programming and real time display options; the demo uses canned data for viewing.
Page 18
Download . . . Logger Files . . . Diagnostics Display Data Graph 1 . . . Display Data in Tables Collected From CR9000. Display Data Graph 2 . . . Graphing requires no special processing of the ID2000 . . .
Page 19
CR9000 program, wiring diagram, output table, description, and configuration file. Program Editor Create programs directly or edit those created by the program generator or retrieved from the CR9000. Provides context-sensitive help for the CR9000's BASIC-like language. Edit REALTIME Virtual Meter Updates up to five displays simultaneously.
Handles files of unlimited size. Historical graphing requires no special processing of the data and provides rapid feedback to the operator. TOOLS Control and Communications Supports PC to CR9000 communications: clock read/set, status read, program download, and program retrieval. COLLECT Collect data from CR9000 data tables DISPLAY Configure the font and color scheme in an active window.
Page 21
71.58 minutes befo r e i t r o l l s ove r. The DA M AGE: ±150 V ±1000 maximum CR9000 scan rate is 1 minu t e. ±200 TYPICAL CURRENT DRAIN: 15 mA active SWITCH CLOSURE MODE (4 channels) ±50...
Page 22
CR9000 Overview This is a blank page. OV-16...
1.1.2 Quick Connectors Some customers who use CR9000s for numerous tests requiring the same or similar sets of sensors have found it useful to pre-wire the CR9000 to a set of plug-in quick connectors that mate with those installed on their sensors.
Individual sensor leads (and multiconductor cables) may be routed directly from the sensor locations to the CR9000 or routed to a junction box and then to the CR9000. When sensors are spread out over a large area, a junction box provides a convenient method for changing sensors in one location quickly.
Power to the CR9000 is controlled by the ON/OFF toggle switch. The power LED is lit when the CR9000 is on. It goes off when the switch is in the off position or when the CR9000 is powered off under program control (PowerOff instruction).
Page 27
Output Current 3.5 A maximum NOTE At typical CR9000 current demand, the batteries are 100% discharged at a system battery voltage of 10.5 V. Discharging the batteries below this voltage damages the cells. As can be seen from the above table, battery life expectancy decreases with depth of discharge.
Peripheral Adapter Module As an example, the current drain of a CR9000 System containing the base system (CPU Module, A/D Module, and Power Supply Module: 410 mA / 485 mA) 1 9060 Excitation Module (108 mA / 125 mA, this does not include the...
Section 1. Installation Because the charge input supplies power to charge the CR9000 batteries (up to two amps when discharged) as well as power the CR9000, the current drawn from the vehicle could be in excess of three amps. 1.2.3 Solar Panels In a remote installation, solar panels, in conjunction with a large external battery, may be used to power the CR9000.
2. When attaching an external battery to the CR9000, insulate the bare lead ends to protect against accidental shorting while routing the power leads. 3. When the CR9000 is to be located in a gas-tight enclosure or used in a gas-tight mode with the standard ENVIRONMENTALLY SEALED FIBERGLASS CASE, the internal lead acid batteries SHOULD BE REMOVED and an external battery substituted.
Problems with exceeding common mode range may be encountered when the CR9000 is used to read the output of external signal conditioning circuitry if a good ground connection does not exist between the external circuitry and the CR9000. When operating where AC power is available, it is not always safe to assume that a good ground connection exists through the AC wiring.
When PC9000 requests data from a table that is stored in Flash memory or a PC card, the CR9000 only looks for the data in flash memory or in the PC card when the oldest data are requested or if the data are not available in CPU memory.
Data stored on cards can be retrieved through one of the communication links to the CR9000 or by removing the card and inserting it in a PC card slot in a computer. Converting the data using the computer's PC card slot is much faster than retrieving it through the CR9000 using one of the communication links.
Data can be transferred into a computer using PC9000 via a communications link or by transferring a PC card from the PC9000 to the computer. There are three ways to collect data via a link to the CR9000 using the PC9000 software:.
Collect Data dialog box (Figure 2.3.1). The station name (may be entered by the user when a program is downloaded) is retrieved from the connected CR9000 and shown at the top. FIGURE 2.3-1. Collect Data Dialog Box 2.3.1.1 File Type ASCII With Time –...
Page 37
All Records, Create New File – Collects the entire table stored in the CR9000. PC9000 gets the current record number from the table in the CR9000 and then retrieves the oldest record in the table up to the current record number. The number in the file name is incremented to create the file name in which the data are stored.
Write File box is unchecked or until the window is closed. This collection method requires that the PC is connected to the CR9000 while the data are collected. Because the beginning and end points of the...
Any of the files shown in logger files can be copied to the computer by highlighting the file and pressing the retrieve button. Data files in the CR9000 CPU and Flash memory are not shown. The retrieved data file is stored on the computer in the same form that it was stored on the PC card (TOB2).
Section 2. Data Storage and Retrieval 2.3.4 Via PCMCIA PC Card When the CR9000 is used without a computer in the field, or large data files are collected on a PC card, the PC card can be transported to the computer with the data on it.
Section 2. Data Storage and Retrieval FIGURE 2.3-3. File Conversion Dialog Box 2.4 Data Format on Computer The format of the file stored on disk can be either ASCII or Binary depending on the file type selected in the collect data dialog box. Files collected from a real time window are always stored in ASCII format.
Page 42
The data table name. Field Name The name of the field in the data table. This name is created by the CR9000 by appending underscore ( _ ) and a three character mnemonic for the output processing. Field Units The units for the field in the data table. Units are assigned in the program with the units declaration.
Field Data This is the data for each of the fields in the record. 2.4.2 TOA5 ASCII File Format The following is a sample of a file collected as ASCII with time stamps. "TOA5","Bob's9K","CR9000","1048575","1.00","EXPLDAT.DLD","4339","Temp" "TIMESTAMP","RECORD","RefTemp_Avg","TC_Avg(1)","TC_Avg(2)","TC_Avg(3)","TC_Avg(4) " "TS","RN","degC","degC","degC","degC","degC" "","","Avg","Avg","Avg","Avg","Avg"...
Section 2. Data Storage and Retrieval 2.4.3 TOB1 Binary File Format This is a sample of a file collected as Binary with time stamps. TOB1,Bob's9K,CR9000,1048575,1.00,EXPLDAT.DLD,4339,Temp SECONDS,NANOSECONDS,RECORD,RefTemp_Avg,TC_Avg(1),TC_Avg(2),TC_Avg(3),TC_Avg(4) SECONDS,NANOSECONDS,RN,degC,degC,degC,degC,degC ,,,Avg,Avg,Avg,Avg,Avg UINT4,UINT4,UINT4,IEEE4,IEEE4,IEEE4,IEEE4,IEEE4 (data lines are binary and not directly readable ) This is an example of binary without time stamps.
CR9070 and CR9071 Pulse modules are covered in Section 3.4. 3.1.1 Analog Voltage Measurement Sequence The CR9000 measures analog voltages with a sample and hold analog to digital (A/D) conversion. The signal at a precise instant is sampled and this voltage is held or "frozen"...
Page 46
The default CR9000 delays, 10 µs for the 5000 and 1000 mV ranges and 20 µs for the 200 and 50 mV ranges, are the minimum required for the CR9000 to settle to within its accuracy specifications.
The CR9000 uses digital integration. An integration time in microseconds (10 µs resolution) is specified as part of the measurement instruction. The CR9000 will repeat measurements every 10 µs throughout the integration interval and store the average as the result of the measurement.
Page 48
1 mV greater at the sensor than at the point where the CR9000 is grounded, the measured voltage would be 1 mV greater than the thermocouple output, or approximately 25 C high.
Page 49
Problems with exceeding common mode range may be encountered when the CR9000 is used to read the output of external signal conditioning circuitry if a good ground connection does not exist between the external circuitry and the CR9000. When operating where AC power is available, it is not always safe to assume that a good ground connection exists through the AC wiring.
The default delays used by the CR9000 are 10 µs on the ±5000 and ±1000 mV ranges and 20 µs on the ±200 and ±50 mV range. This settling time is the minimum required to allow the input to settle to the resolution specification.
Reference Junction Temperature with 9050 The PRT in the CR9000 is mounted on the circuit board near the center of the 9050 terminal strip. This resistance temperature device (RTD) is accurate to C over the CR9000 operating range. The I/O Module was designed to ±0.1...
9050 module can be used for thermocouples connected to other modules. A foam block that fits under the terminal cover is sent with the CR9000. When installed, this block insulates and limits air circulation around the terminals.
Page 53
Accuracy of the Thermocouple Voltage Measurement The accuracy of a CR9000 voltage measurement is specified as 0.07% the measured voltage plus 4 A/D counts of the range being used to make the measurement. The input offset error reduces to 1 A/D count if a differential...
Page 54
Section 3. CR9000 Measurement Details For optimum resolution, the ±50 mV range is used for all but high temperature measurements (Table 3.4-2). The input offset error dominates the voltage measurement error for environmental measurements. A temperature difference of 40 to 60 °C between the measurement and reference junctions is required for a thermocouple to output 2.285 mV, the voltage at which 0.07% of the...
Page 55
The ranges covered by these linearizations include the CR9000 environmental operating range, so there is no problem when the CR9000 is used as the reference junction. External reference junction boxes however, must also be within these temperature ranges.
Page 56
CR9000 are likely to be due to the limits of error on the thermocouple wire and in the reference temperature determined with the 9050 RTD. Errors in the thermocouple and reference temperature linearizations are extremely small, and error in the voltage measurement is negligible.
Page 57
An external junction box is often used to facilitate connections and to reduce the expense of thermocouple wire when the temperature measurements are to be made at a distance from the CR9000. In most situations it is preferable to make the box the reference junction in which case its temperature is measured and used as the reference for the thermocouples and copper wires are run from the box to the CR9000.
Radiation shielding must be provided when a junction box is installed in the field. Care must also be taken that a thermal gradient is not induced by conduction through the incoming wires. The CR9000 can be used to measure the temperature gradients within the junction box.
Page 59
Section 3. CR9000 Measurement Details X = result w/mult = 1, offset = 0 BrHalf − − X = result w/mult = 1, offset = 0 BrHalf3W − − BrHalf4W X = result w/mult = 1, offset = 0 BrFull X = result w/mult = 1, offset = 0 ⎛...
This ground loop arises because the soil and water provide an alternate path for the excitation to return to CR9000 ground, and can be represented by the model diagrammed in Figure 3.6-1.
The ground electrode of the conductivity or soil moisture probe and the CR9000 earth ground form a galvanic cell, with the water/soil solution acting as the electrolyte. If current was allowed to flow, the resulting oxidation or reduction would soon damage the electrode, just as if DC excitation was used to make the measurement.
Section 3. CR9000 Measurement Details CR9050(E) are multiplexed sequentially through a single A to D converter. 3.2.1 CR9058E Supported Instructions The CR9058E currently supports three CR9000X measurement instructions: VoltDiff (Dest, Reps, Range, ASlot, DiffChan, RevDiff, Settle, Integ, Mult, Offset) TCDiff (Dest, Reps, Range, ASlot, DiffChan, TCType, TRef, RevDiff,...
Page 63
(Tools/Diagnostics/Terminal Mode). In the I/O Port area, click on "Open Port". Next, click in the Low Level I/O section and hit Enter several times until the CR9000> prompt is returned. Type in "4" and enter. The CR9058Es' slot numbers, integration times, and sync filters will be returned.
Section 3. CR9000 Measurement Details • The CR9058E does not directly support Bridge measurements, but Bridge type measurements can be performed through using the CR9060s CAOs or external excitation and adjusting the multiplier according to the excitation level. 3.2.2 CR9058E Sampling, Noise and Filtering The ten analog to digital converters are re-synchronized at the beginning of each scan.
Page 65
Section 3. CR9000 Measurement Details C H A R T 3 .1 F R E Q U E N C Y R E S P O N S E O F S Y N C F IL T E R O R D E R S 1 - 5 1 .2...
Section 3. CR9000 Measurement Details 3.3 CR9052 Filter Module Measurements Each CR9052 module has six differential analog measurement channels with programmable input ranges from ±20 mV to ±5 V. Each channel has its own programmable-gain instrumentation amplifier, pre-sampling analog filter, and sigma-delta analog-to-digital converter.
Page 67
Section 3. CR9000 Measurement Details appropriate low-pass filter to anti-alias the input data for the user's desired measurement rate. If desired, users may load their own coefficients into the on-board DSP to tailor the FIR filter's frequency response to their own needs (band pass, band reject, etc.).
Page 68
Section 3. CR9000 Measurement Details WINDOWING The FFT option allows radix-two (2 , where n = 5, 6, …16) transform lengths ranging from 32 to 65,536 samples. Users can optionally apply a Hanning, Hamming, Blackman-Harris, or one from a selection of Kaiser-Bessel beta choices, window function to their time series before transforming them.
Section 3. CR9000 Measurement Details SPECTRAL OUTPUT The CR9052 offers a variety of spectrum normalizations, including real and imaginary, amplitude and phase, power, power spectral density (PSD), and decibels (dB). In addition, the CR9052 can combine adjacent spectral bins into a single bin to decrease the size of the final spectrum.
Page 70
Section 3. CR9000 Measurement Details The resolution of the pulse counters is one count. The resolution of the calculated frequency depends on the scan interval: frequency resolution = 1/scan interval (e.g., a pulse count in a 1 second scan has a frequency resolution of 1 Hz, a 0.5 second scan gives a resolution of 2 Hz, and a 1 ms...
Page 71
Section 3. CR9000 Measurement Details trigger must rise from below 1.5 volts to above 3.5 volts in order to trigger an output. Due to the attenuation caused by the filter on the front side of the Schmitt circuit, a larger input voltage transition is required for higher frequencies.
Page 72
Section 3. CR9000 Measurement Details This is a blank page. 3-28...
Section 4. CRBasic – Native Language Programming The CR9000 is programmed in a language that has some similarities to a structured basic. There are special instructions for making measurements and for creating tables of output data. The results of all measurements are assigned variables (given names).
Repetitions, the number of sequential 9050 modules to measure the temperature of; Aslot, the slot in the CR9000 that the analog card is in; and Integration, the length of time to integrate the measurement.
Section 4. CRBasic – Native Language Programming The program section defines the action of datalogging Program Set scan interval The scan sets the interval for a series of measurements Measurements Enter the measurements to make Enter any additional processing with the measurements Processing Call Data Table(s) The Data Table must be called to process output data...
The data table header also has a row that lists units for the output values. The units must be declared for the CR9000 to fill this row out (e.g., Units RefTemp = degC). The units are strictly for the user's documentation; the CR9000 makes no checks on their accuracy.
TABLE 4.3-1 Formats for Output Data Code Data Format Size Range Resolution ±7999 Campbell Scientific floating point 2 bytes 13 bits (about 4 digits) IEEE4 IEEE four byte floating point 4 bytes 1.8 E -38 to 1.7 E 38 24 bits (about 7 digits)
Section 4. CRBasic – Native Language Programming BeginProg Scan(1,MSEC,0,0) ModuleTemp(RefTemp,1,4,0) TCDiff(TC(),6,mV50,4,1,TypeT,RefTemp,RevDiff,Del,Integ,Mult,Offset) CallTable Temp NextScan EndProg The Scan instruction determines how frequently the measurements within the scan are made: Scan(Interval, Units, BurstOption, Count) Scan(1,MSEC,0,0) The Scan instruction has four parameters. The Interval is the interval between scans.
Section 4. CRBasic – Native Language Programming The CR9000 uses -1 rather than some other non-zero number because the and and or operators are the same for logical statements and binary bitwise comparisons (see and and or in Section 8). The number -1 is expressed in binary with all bits equal to 1, the number 0 has all bits equal to 0.
Section 4. CRBasic – Native Language Programming 4.7.1 Expressions in Parameters 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 (Section 4.5.3). An example of the use of this is in the DataTable instruction where the trigger condition can be entered as an expression.
Page 82
Section 4. CRBasic – Native Language Programming In addition to accessing the data actually output in a table, there are some pseudo fields related to the data table that can be retrieved: Tablename.record(1,n) = the record number of the record output n records ago. Tablename.Tablesize(1,1) = the size of the table in records.
Section 5. Program Declarations ALIAS Used to assign a second name to a variable. Syntax Alias VariableA = VariableB Remarks Alias allows assigning a second name to a variable. Within the datalogger program, either name can be used. Only the alias is available for Public variables. The alias is also used as the root name for datatable fieldnames.
Page 84
When variables are initialized, they are initialized to 0 Put Dim statements at the beginning of the program. PUBLIC Dimensions a variable as public and available in the Public table of the CR9000. Syntax Public( list of [dimensioned] variables that make up the Public Table Remarks More than one Public statement can be made.
Page 85
Data Table Info file of PC9000. The unit name is a text field that allows the user to label data. When the user modifies the units, the text entered is not checked by PC9000 or the CR9000. Example...
Page 86
Section 5. Program Declarations The Sub statement has these parts: Part Description Subroutine Marks the beginning of a SubName Name of the Subroutine. Because Subroutine names are recognized by all procedures in all modules, subname cannot be the same as any other globally recognized name in the program. VariableList List of variables that are passed to the Subroutine when it is called.
Page 87
Section 5. Program Declarations Subroutine Example 'CR9000 ''Declare Variables used in Program: Public RefT, TC(4),I 'Data output in deg C: DataTable (TempsC,1,-1) DataInterval (0,5,Min,10) Average (1,RefT,FP2,0) Average (4,TC(),FP2,0) EndTable 'Same Data output in F after conversion: DataTable (TempsF,1,-1) DataInterval (0,5,Min,10)
Page 88
Section 5. Program Declarations This is a blank page.
Section 6. Data Table Declarations and Output Processing Instructions 6.1 Data Table Declaration DataTable (Name, TrigVar, Size) output trigger modifier export data destinations output processing instructions EndTable DataTable is used to declare/define a data table. The name of the table, output trigger and size of the table in RAM are set with DataTable.
Interval driven data allows a more efficient use of memory because it is not necessary to store time with each record. The CR9000 still stores time but on a fixed spacing, only about once per 1 K of memory used for the table. As each new record is stored, time is checked to ensure that the interval is correct.
Page 91
Constant OpenInterval When the DataInterval instruction is included in a data table, the CR9000 uses only values from within an interval for time series processing (e.g., average, maximum, minimum, etc.). When data are output every interval, the output processing instructions reset each time output occurs.
Page 92
Do not trigger ≠ 0 Trigger StopTrig The variable, expression or constant to test to stop storing to the data table. The CR9000 Variable, does not start checking for the stop trigger until after the Start Trigger occurs. A non-zero Expression or...
Page 93
Section 6. Data Table Declarations and Output Processing Instructions DataEvent Example: In this example, 5 type T thermocouples are measured. The trigger for the start of an event is when TCTemp(1) exceeds 30 degrees C. The stop trigger is when TCTemp(1) less than 29 degrees C. The event consists of 20 records prior to the start trigger and continues to store data until 10 records following the stop trigger.
Page 94
Section 6. Data Table Declarations and Output Processing Instructions WorstCase (TableName, NumCases, MaxMin, Change, RankVar) Allows saving the most significant or “worst-case” events in separate data tables. A data table is created that is sized to hold one event. This table acts as the event buffer.
Page 95
Section 6. Data Table Declarations and Output Processing Instructions WorstCase Example This program demonstrates the Worst Case Instruction. Five type T thermocouples are measured. The event is similar to that in the example for the DataEvent instruction; the trigger for the start of a data event is when TC(1) exceeds 30 degrees C.
Section 6. Data Table Declarations and Output Processing Instructions 6.3 Export Data Instructions DSP4 (FlagVar, Rate) Send data to the DSP4. If this instruction appears inside a DataTable, the DSP4 can display the fields of this Table, otherwise, the Public Variables are used by the DSP4.
Parameter PamOut Parameters Enter & Data Type The number of the slot in the CR9000 card frame that holds the PAM Module. Slot Constant Card The card (A or B) in which to store the data on the PAM module...
Page 98
Numeric Code Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point A non-zero value will disable intermediate processing. When the disable variable is ≠0 the current DisableVar Constant, input is not included in the Covariance.
Page 99
Numeric Code Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point Number of points in the original time series. The number of points must be a power of 2 (i.e., 512, 1024, 2048, etc.). Constant The sampling interval of the time series.
Page 100
Section 6. Data Table Declarations and Output Processing Instructions Notes: • Power is independent of the sampling rate (1/tau) and of the number of samples (N). • The PSD is proportional to the length of the sampling period (T=N*tau), since the “width” of each bin is 1/T. •...
Page 101
Section 6. Data Table Declarations and Output Processing Instructions FFT Example Const SIZE_FFT 16 CONST PI 3.141592654 Const CYCLESperT 2 Const AMPLITUDE 3 Const DC 7 Const OPT_FFT 0 CONST PI 3.141592654 dim i public x(SIZE_FFT),y(SIZE_FFT) DataTable(Amp,1,1) fft(x,fp2,SIZE_FFT,10 msec,1) EndTable DataTable(AmpPhase,1,1) fft(x,fp2,SIZE_FFT,10 msec,2) EndTable...
Page 102
FieldNames “list of fieldnames” The FieldNames instructions may be used to override the fieldnames that the CR9000 generates for results sent to the data table. Fieldnames must immediately follow the output instruction creating the data fields. Field names are limited to 19 characters. Individual names may be entered for each result generated by the previous output instruction or an array may used to name multiple fields.
Page 103
Section 6. Data Table Declarations and Output Processing Instructions Histogram (BinSelect, DataType, DisableVar, Bins, Form, WtVal, LowLim, UpLim) Processes input data as either a standard histogram (frequency distribution) or a weighted value histogram. The standard histogram counts the time that the bin select variable is within particular sub-range of its specified range.
Page 104
Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point A non-zero value will disable intermediate processing. Normally 0 is entered so all inputs are processed. DisableVar For example, when the disable variable is ≠0 the current input is not included in the histogram. The Constant, histogram that is eventually stored includes the inputs that occurred while the disable variable was 0.
Page 105
Section 6. Data Table Declarations and Output Processing Instructions Histogram4D Output Example '\\\\\\\\\\\\\\\\\\\\ VARIABLES and CONSTANTS //////////////////// Public mAmps Public Volts Dim Bin(2) Units Bin = Percent '\\\\\\\\\\\\\\\\\\\\\\\\ OUTPUT SECTION //////////////////////// DataTable ("HIST4D",1,100) DataInterval(0,1,Sec,100) Histogram4D(Bin(), FP2, 0, 2, 4, 0, 0, 001, 100, 12, 14, -25, 0, 0, 0, 0, 0) EndTable DataTable ("VALUES",1,100) 'Trigger, buffer of 100 Records...
Page 106
Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point A non-zero value will disable intermediate processing. Normally 0 is entered so all inputs are processed. DisableVar For example, when the disable variable is ≠0 the current input is not included in the histogram. The Constant, histogram that is eventually stored includes the inputs that occurred while the disable variable was 0.
Page 107
Section 6. Data Table Declarations and Output Processing Instructions The source value may be the result of a measurement or calculation. Each time the data table with the Level Crossing instruction is called, the source is checked to see if its value has changed from the previous value and if in any change it has crossed any of the specified crossing levels.
Page 108
Section 6. Data Table Declarations and Output Processing Instructions Crossing Levels Crossing Source 2nd Dim Boundary 2ndDim Source FIGURE 6.4-2. Crossing Data with Second Dimension Value Point Crossing 2nd Dim Action Source Source First value, no counts Add one count to first crossing, second 2D bin, the signal crossed Histogram: 2D <...
Page 109
The name of the Variable that is the input for the instruction. Source Variable A code to select the data storage format. DataType Constant Alpha Code Numeric Code Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point 6-21...
Page 110
Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point DisableVar A non-zero value will disable intermediate processing. Normally 0 is entered so all inputs are processed. For example, when the disable variable is ≠0 the current input is not checked for a new minimum. The Constant, minimum that is eventually stored is the minimum that occurred while the disable variable was 0.
Page 111
Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point DisableVar A non-zero value will disable intermediate processing. Normally 0 is entered so all inputs are processed. For example, when the disable variable is ≠0 the current input is not included in the histogram. The Constant, histogram that is eventually stored includes the inputs that occurred while the disable variable was 0.
Page 112
Section 6. Data Table Declarations and Output Processing Instructions that were associated with that bin (i.e., number of cycles in bin divided by total number of cycles counted). The user enters the number of mean bins, the number of amplitude bins, and the upper and lower limits of the input data.
Page 113
DataType Constant Alpha Code Numeric Code Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point StdDev (Reps, Source, DataType, DisableVar) StdDev calculates the standard deviation of the Source(s) over the output interval. ⎛ ⎞ ⎛...
Page 114
Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point A non-zero value will disable intermediate processing. Normally 0 is entered so all inputs are processed. DisableVar For example, when the disable variable is ≠0 the current input is not included in the total. The total that Constant, is eventually stored is the total of the inputs that occurred while the disable variable was 0.
Page 115
Section 7. Measurement Instructions 7.1 Voltage Measurements VoltDiff – Differential Voltage Measurement..........7-3 VoltSE – Single-ended Voltage Measurement ..........7-3 7.2 Thermocouple Measurements Measure the output of thermocouples and convert to temperature. TCDiff – Differential Voltage Measurement of Thermocouple ....7-3 TCSE –...
Page 116
Section 7. Measurement Instructions 7.8 Digital I/O PortSet – Sets Digital Ports on 9060 Excitation Module ......7-21 PulseCount – Pulse/Frequency Measurement on CR9070/CR9071E Counter-Timer Digital I/O Module............ 7-22 PulseCountReset – Resets Pulse Counters and Running Averages Used in Pulse Count Instruction ............7-23 ReadIO –Reads State of Digital I/O Ports on CR9070/CR9071E Module 7-23 TimerIO –...
Section 7. Measurement Instructions 7.1 Voltage Measurements VoltDiff (Dest, Reps, Range, ASlot, DiffChan, RevDiff, SettlingTime, Integ, Mult, Offset) Diff. Chanel H Sensor Diff. Chanel L. This instruction measures the voltage difference between the HI and Low inputs of a differential channel. Both the high and low inputs must be within ± 5V of the datalogger's ground (See Common Mode Range, Section 3.2).
Page 118
Section 7. Measurement Instructions TCSE (Dest, Reps, Range, ASlot, SEChan, TCType, TRef, SettlingTime, Integ, Mult, Offset) S.E. Chanel Thermocouple Ground This instruction measures a thermocouple with a single-ended voltage measurement and calculates the thermocouple temperature (°C) for the thermocouple type selected. The instruction adds the measured voltage to the voltage calculated for the reference temperature relative to 0°...
Page 119
Section 7. Measurement Instructions VOLTDIFF AND TCDIFF INSTRUCTION PARAMETERS Parameter Enter RevDiff Option to reverse inputs to cancel offsets. The sign corrected average of these measurements is used in Constant the result. This technique cancels voltage offsets in the measurement circuitry but requires twice as much time to complete the measurement.
Section 7. Measurement Instructions VOLTSE & TCSE INSTRUCTION PARAMETERS Parameter Enter & Data Type TCType The code for the thermocouple type. Constant Numeric Code Thermocouple Type Alpha Code Copper Constantan TypeT Chromel Constantan TypeE Chromel Alumel TypeK Iron Constantan TypeJ TypeB Platinum Rhodium TypeR...
Page 121
Section 7. Measurement Instructions This Instruction applies an excitation voltage, delays a specified time and then makes a single ended voltage measurement. The result with a multiplier of 1 and an offset of 0 is the ratio of the measured voltage divided by the excitation voltage.
Page 122
Section 7. Measurement Instructions Parameter BRHALF, BRHALF3W, BRHALF4W PARAMETERS Enter & Data Type The Variable in which to store the results of the instruction. When Reps are used the results are stored in an Dest array with the variable name. An array must be dimensioned to have elements for all the Reps. Variable or Array Reps...
Section 7. Measurement Instructions Parameter BRHALF, BRHALF3W, BRHALF4W PARAMETERS Enter & Data Type The integration time in microseconds for each of the channels measured (10 microseconds resolution). Integ Constant Mult, Offset A multiplier and offset by which to scale the raw results of the measurement. Constant, Variable, Array, or...
Section 7. Measurement Instructions the measurement of the voltage drop across the full bridge, and V 2 is the measurement of the bridge output. 7.5 Excitation/Continuous Analog Output Excite (ExSlot, ExChan, ExmV, SettlingTime) This instruction sets the selected excitation output to a specific value. Channels 1 through 6 are continuous analog output channels and will remain at the excitation voltage set by the instruction unless a subsequent instruction changes their voltage.
The integration time in microseconds for each of the channels measured (10 microseconds resolution). Constant The CR9000 will repeat measurements every 10 microseconds throughout the integration interval (with the appropriate Delay at the beginning and between RevDiff and RevEx if used) and output the average.
AM25T (AM25TChan, CardAnlg, ChanAnlg, CardPort, ClkPort, ResPort, ChanExcite) This Instruction controls the AM25T Multiplexer when used with the CR9000. The AM25T instruction precedes the instruction used to make the measurements on the AM25T, and must be inserted before any instruction that makes a measurement on the AM25T.
Page 127
The Excitation Channel number on the CR9060 Module that will be used to provide excitation Constant for the PRT reference temperature measurement. 'This example demonstrates using the AM25T thermocouple multiplexer 'with the CR9000. '\\\\\\\\\\ VARIABLES and CONSTANTS ////////// Const AM25TChan = 1 'starting channel in AM25T...
Page 128
Section 7. Measurement Instructions CANBUS (Dest, SDMAddress, TimeQuanta, TSEG1, TSEG2, ID, DataType, StartBit, NumBits, NumVals, Multiplier, Offset) The CANBUS instruction is used to measure and control the SDM-CAN interface. Multiple CANBUS instructions may be used within a program. The initial function of the instruction is to configure the SDM-CAN interface when the datalogger program is compiled.
Page 129
Section 7. Measurement Instructions Parameter CANBUS INSTRUCTION PARAMETERS Enter & Data Type Each device on a CAN-bus network prefaces its data frames with an 11 or 29 bit identifier. Constant The ID parameter is used to set this address. The ID is entered as a single decimal equivalent. Enter a positive value to signify a 29 bit ID or a negative value to signify an 11 bit ID.
Page 130
Section 7. Measurement Instructions Parameter CANBUS INSTRUCTION PARAMETERS Enter & Data Type Status Description 0000 SDM-CAN involved in bus activities; error counters < than 96. 0001 SDM-CAN involved in bus activities; one or more error counters is greater than or equal to 96. 0002 SDM-CAN is not involved in bus activities;...
Page 131
CSAT3 (Dest, Reps, Address, Command) Communicates with the CSAT3 three dimensional sonic anemometer. See CSAT3 manual for more information. INT8 INTERVAL TIMER Used to control the INT8, an 8 Channel Interval Timer module, using the CR9000. Syntax INT8(Dest, Address,Config8_5,Config4_1, Funct8_5,Funct4_1,OutputOpt,CaptureTrig, Mult, Offset ) 7-17...
Page 132
Remarks This Instruction allows the use of the SDM-INT8, 8 Channel Interval Timer, with the CR9000. The INT8 is a (S)ynchronous (D)evice for the (M)easurement of intervals, counts between events, frequencies, periods, and/or time since an event. See the INT8 manual for more information about its capabilities.
Page 133
Section 7. Measurement Instructions Parameter Enter INT8 INSTRUCTION PARAMETERS & Data Type Each of the 8 input channels can be independently programmed for one of eight different Funct8_5 Funct4_1 timing functions. Funct8_5 is a four digit code to program the timing functions of INT8 Constants channels 5 through 8.
Page 134
C. A multiplier of 1.8 and an offset of 32 will convert the temperature to degrees F. Array, or Expression SDMSpeed (SDMSpeed) Changes the rate that the CR9000 uses to clock the SDM data. Slowing down the clock rate may be necessary when long cables lengths are used to connect the CR9000 and SDM devices. Parameter...
Section 7. Measurement Instructions SIO4 (Dest, Reps, Address, Mode, Command, FirstOp, SecOp, ValuesPerRep, Mult, Offset) This Instruction communicates with theSDM-SIO4 Serial Input Multiplexer. See the SDM-SIO4 Manual for details. SIO4 INSTRUCTION PARAMETERS Parameter Enter & Data Type Dest The Variable in which to store the results of the instruction or, when the instruction is used to send Variable or Array data, this array becomes the data to send.
Page 136
Section 7. Measurement Instructions PulseCount (Dest, Reps, PSlot, PChan, PConfig, POption, Mult, Offset) This instruction should not be placed in a conditional or in a Slow Sequence Scan. Sets up pulse measurements using the twelve 16 bit counter channels on the CR9070 or the twelve 32 bit counters channels on the CR9071E Counter module.
Page 137
1 MHz, it would take almost 72 minutes before it fills while the CR9000's maximum scan rate is 1 minute. With each scan, the CR9000 reads the counts accumulated since the last scan and then resets the counter. If...
Page 138
Section 7. Measurement Instructions binary format by preceding the number with "&B". For example if the mask is entered as &B100 (leading zeros can be omitted in binary format just as in decimal) and ports 3 and 1 are high as in the previous example, the result of the instruction will be 4 (decimal, binary = 100);...
Page 139
Section 7. Measurement Instructions The second mode is to stay within the instruction until it has results for each measurement requested. In this mode, the resolution when using the I/O channels is approximately (10 microseconds + 15 microseconds * the number of results requested). The resolution for the CR9071's Pulse channels is 40 nanoseconds.
Section 7. Measurement Instructions WriteIO (PSlot, Mask, Source) WriteIO is used to set the status of selected digital I/O channels (ports) on the CR9070/CR9071E Counter - Timer / Digital I/O Module. (See PortSet for setting the Output channels on the CR9060.) There are 16 ports on the CR9070/CR9071E.
SubScan) determines the filter module output interval. Data are passed from the Filter Module to the CR9000 CPU for processing and final storage at this scan interval. There is the option of turning on a fixed excitation (10V, 5V, or 10 mA).
Page 142
Section 7. Measurement Instructions Parameter VOLTFILT PARAMETERS Enter & Data Type The Variable to store the results of the instruction. When Reps are used the results are stored in an Dest array with the variable name. An array must be dimensioned to have elements for all Reps. Variable,Array Reps The number of times to repeat the measurement on subsequent CR9052 channels.
Section 7. Measurement Instructions The following example program measures 6 channels on the CR9052DC using the VoltFilt instruction. CR9052 example program #1 Measure six channels at 1 kHz on +/- 5000 mV range with 5-Volt excitation. ‘ Sample ratio is 2.5: top of pass band is 1 kHz / 2.5 = 400 Hz. ‘...
Page 144
Section 7. Measurement Instructions The following program uses the SubScan to combine 2.5 kHz filtermodule measurements with 10 Hz measurements on a 9050 card. ' CR9052 example program #2 ' Measure 2 channels on the CR9050 at 10 Hz on the +/- 5000 mV range. ' Measure six channels on the CR9052DC at 2.5 kHz on +/- 5000 mV range with 5-Volt excitation.
Page 145
Section 7. Measurement Instructions Bursting to CPU and PAM Memory The maximum continuous throughput rate for measurements made by the CR9052DC to be processed and stored by the CR9031 CPU is 2500 Hz for 1 to 24 channels. The measurement rate can be increased by bursting data into CPU memory or PC cards in the CR9080 PAM Module.
Page 146
20 kHz, etc. Because each CR9052DC Filter Module includes its own burst memory buffer, the total burst buffer capacity increases as experimenters add additional Filter Modules within the CR9000 chassis. The Filter Module will burst measurements to its on-board memory when the CRBASIC program specifies the burst option in the Scan instruction, and when the program contains a VoltFilt instruction within a SubScan.
The CR9052 filter module can perform real-time fast Fourier transform (FFT) analyses on the voltages measured on its inputs, and then pass the resulting spectra to the CR9000 CPU for further processing and storage into data tables. The FFT operation is specified with the FFTFilt instruction.
Page 148
Section 7. Measurement Instructions Parameter FFTFILT PARAMETERS Enter Dest Because FFTFilt returns all or part of The Variable in which to store the results of the instruction. Variable or an entire spectrum (see ILow and IHigh) for each Rep, Dest usually must be an array. Array Reps The number of times to repeat the measurements and subsequent FFTs on consecutive...
Page 149
Section 7. Measurement Instructions Parameter FFTFILT PARAMETERS Enter Excitation The continuous, dc, output level for the excitation channel(s). If Reps is greater than one, then Constant the Filter Module drives the same excitation level on sequential excitation outputs. Numeric Code Alpha Code Output Level IEPE Freq.
Page 150
Section 7. Measurement Instructions Parameter FFTFILT INSTRUCTION PARAMETERS Enter & Data Type TSWindow TSWindow designates whether the CR9052 should apply a window (also known as a taper, or Constant apodization) function to the time series snapshot before performing the FFT. Typical window functions give more weight to the middle of the time series while tapering the ends to avoid spectral leakage caused by a non-integral number of periods of a repetitive signal in the snapshot.
Page 151
Section 7. Measurement Instructions Window Function TSWindow is a constant designating whether the CR9052 should apply a window (also known as taper, or apodization) function to the time series snapshot before performing the FFT. Typical window functions give more weight to the middle of the time series while tapering the ends to avoid spectral leakage caused by a non-integral number of periods of a repetitive signal in the snapshot.
Page 152
(integer) Spectral Options The CR9052DC supports the following spectral options. The first five spectral options are the same as the CR9000 FFT instruction. RMS Amplitude and Decibels are new for the FFTFilt instruction. Real and Imaginary The real and imaginary option returns the raw real (r) and imaginary (i) components from the FFT.
Page 153
Section 7. Measurement Instructions component is computed from and the Nyquist component is computed from The sum of all of the ac components of the power spectrum gives the variance of the original time series. The units of the power spectrum are Power Spectral Density The power spectral density (PSD) function normalizes the power spectrum by the bandwidth of each spectral component.
Page 154
Section 7. Measurement Instructions ⎛ ⎞ ⎜ ⎟ is equal to power, an equivalent normalization to dB is ⎜ ⎟ ⎝ ⎠ where is the value from the power spectrum, and is power reference level. The square of the inverse of the multiplier parameter (Mult ) gives .
Page 155
Section 7. Measurement Instructions In terms of frequency: To limit the lower end of the spectrum, select a minimum frequency of interest, ⎛ ⎞ ⎜ ⎜ ⎟ ⎟ round , and then set Ilow to: ⎝ ⎠ round where rounded to the nearest integer. To limit the upper end of the spectrum, select a maximum frequency of ⎛...
Page 156
Section 7. Measurement Instructions Alaising is not a problem with filter option 1 because any signals in the transition band up to the stop frequency of 26.8 kHz will be alaised to frequencies higher than the pass frequency of 23.2 kHz. The pass frequency (F ) is the maximum frequency that is not attenuated by PASS...
Page 157
Section 7. Measurement Instructions For a given sample rate, , if better frequency resolution is required (i.e., more bins, each covering a narrower frequency range) increase the number of points in the FFT, N. If less resolution is required (i.e., fewer bins each covering a wider frequency range) decrease the number of points in the FFT or (to keep the minimum frequency from slipping into the DC bin) combine bins as described below.
Page 158
Section 7. Measurement Instructions (parameter FFTLen), and is the number of bins to combine (parameter SBin). The difference between the center frequencies of adjacent spectral components after linear spectral rebinning is , and bandwidth of each spectral component (except the dc component) is also .
Page 159
ILow to its minimum value, and set IHigh to its maximum value. As an alternative to computing the minimum ILow and maximum IHigh from the equations given above, let the CR9000 perform the calculations: Set ILow a very negative value (like -1000) and set IHigh to a very positive value (like 1000).
FFTFilt instruction which uses this source variable as the destination for a spectrum. A code to select the data storage format. DataType Constant Alpha Code Numeric Code Data Format IEEE4 IEEE 4 byte floating point Campbell Scientific 2 byte floating point 7-46...
Section 8. Processing and Math Instructions Operators Raise to Power Multiply Divide Subtract Equals <> Not Equal > Greater Than < Less Than >= Greater Than or Equal <= Less Than or Equal Absolute Value Returns the absolute value of a number. Syntax Abs( number...
Page 162
Section 8. Processing and Math Instructions And Operator Used to perform a bit-wise conjunction on two numbers. Syntax result = number1 number2 The And operator performs a bit-wise comparison of identically positioned bits in two numbers and sets the corresponding bit in result according to the following truth table: If bit in And bit in...
Page 163
Section 8. Processing and Math Instructions Atn() Returns the arctangent of a number. Syntax Atn( number Remarks The argument number can be any valid numeric expression. The Atn function takes the ratio (number) of two sides of a right triangle and returns the corresponding angle.
Section 8. Processing and Math Instructions Average Spatial Output Example This example uses AvgSpa to find the average value of the five elements Temp(6) through Temp(10) and store the result in the variable AvgTemp. AvgSpa(AvgTemp, 5, Temp(6)) Running Average Calculates a running average of a measurement or calculated value. Syntax AvgRun( Dest, Reps, Source, Number...
Page 165
Section 8. Processing and Math Instructions Cosine Returns the cosine of an angle. Syntax Cos( angle Remarks The argument angle can be any valid numeric expression measured in radians. The Cos function takes an angle and returns the ratio of two sides of a right triangle.
Page 166
Section 8. Processing and Math Instructions Parameter CovSpa Parameters Enter & Data Type The Variable in which to store the results of the instruction. When multiple covariances are Dest Variable or calculated, the results are stored in an array with the variable name. An array must be Array dimensioned to at least the value of NumOfCov.
Page 167
Section 8. Processing and Math Instructions FFTSpa (Dest, N, Source, Tau, Units, Option) The FFTSpa performs a Fast Fourier Transform on a time series of measurements stored in an array and places the results in an array. It can also perform an inverse FFT, generating a time series from the results of an FFT.
Page 168
Section 8. Processing and Math Instructions Normalization details: Complex FFT result i, i = 1 .. N/2: ai*cos(wi*t) + bi*sin(wi*t). wi = 2π(i-1)/T. φi = atan2(bi,ai) (4 quadrant arctan) Power(1) = (a1 + b1 (DC) Power(i) = 2*( ai + bi (i = 2..N/2, AC) PSD(i) = Power(i) * T = Power(i) * N * tau A1 = sqrt(a1...
Page 169
Section 8. Processing and Math Instructions Get Record Retrieves one record from a data table. Syntax GetRecord ( Dest, TableName, RecsBack ) Remarks The GetRecord instruction retrieves one entire record from a data table. The destination array must be dimensioned large enough to hold all the fields in the record.
Page 170
Section 8. Processing and Math Instructions IfTime will only return true once per interval. For example, a program with a 1 second scan that tests IfTime(0,10, min) -- 0 minutes into a 10 minute interval – each scan will execute the instruction 60 times during the minute that it could be true.
Page 171
Section 8. Processing and Math Instructions Int, Fix Functions Return the integer portion of a number. Syntax Int( number Fix( number Remarks The argument number can be any valid numeric expression. Both Int and Fix remove the fractional part of number and return the resulting integer value. If the numeric expression results in a Null, Int and Fix return a Null.
Page 172
Stores the results of the most recent memory test in a variable. Syntax MemoryTest ( Dest Remarks The CR9000 tests CPU RAM and Task Sequencer memory when it compiles and runs a program. MemoryTest stores the results of this compile test in a variable Parameter MemoryTest Parameters Enter &...
Page 173
Section 8. Processing and Math Instructions Spatial Minimum Finds the minimum value in a swath of variables in an array. Syntax MinSpa( Dest, Swath, Source Remarks Find the minimum value in the given array and place the result in the array named in Dest.
Page 174
Section 8. Processing and Math Instructions Move Moves a block or fills an array. Syntax Move( Dest, Reps, Source, Reps Remarks Block Move or fill array. Parameters: Dest array, destination reps; Source array or expression; Source reps. If source reps is less than destination reps, the remainder of destination is filled with that last value of source.
Page 175
Section 8. Processing and Math Instructions NOT (-1) = 0 NOT (0) = -1 NOT (NAN) = NAN (NAN= Not A Number) OR Operator Used to perform a bit-wise disjunction on two numbers. Syntax result = number1 number2 The Or operator performs a bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following truth table: If bit in...
Page 176
Section 8. Processing and Math Instructions Both have the same effect, X will be set to –1 if Temp(1) is greater than 50 OR Temp(4) is less than 40. X will be set to 0 if both expressions are false. PeakValley (DestPV, DestChange, Reps, Source, Hysteresis) PeakValley is used to detect peaks and valleys (local maxima and minima) in a signal.
Page 177
Section 8. Processing and Math Instructions DataTable(PVBoth,Change(3),500) Sample(2,PeakV(1),IEEE4) EndTable BeginProg Scan(500,mSec,0,0) Deg=Deg+5 XY(1)=Cos(Deg*Pi/180) ‘Compute the cosine as input XY(1) XY(2)=Sin(Deg*Pi/180) ‘Compute the sine as input XY(2) PeakValley(PeakV(1),Change(1),2,XY(1),0.1) ‘Find the peaks and valleys for both ‘inputs. Hysteresis = 0.1 CallTable PV1 CallTable PV2 CallTable PVBoth Next Scan...
Page 178
Randomize statement with no argument at the beginning of the program. RealTime Used to pick out year, month, day, hour, minute, second, day of week, and/or day of year from the CR9000 clock. Syntax RealTime(Dest) Remarks RealTime Example This example uses RealTime to place all time segments in the Destination array.
Page 179
Section 8. Processing and Math Instructions RectPolar (Dest, Source) Converts from rectangular to polar coordinates. Parameter RectPolar Parameters Enter & Data Type Variable array in which to store the 2 resultant values. The length of the vector is stored in the Dest π...
Page 180
Section 8. Processing and Math Instructions Spatial RMS Used to compute the RMS value of an array. Syntax RMSSpa( Dest, Swath, Source Remarks Spatial RMS, Calculate the root mean square of values in an array. i j swath ∑ Dest swath Where X(j) = Source Parameter...
Page 181
Section 8. Processing and Math Instructions Parameter StrainCalc Parameters Enter & Data Type Variable to store strain in. Dest Reps Number of strains to calculate, Destination, source, and zero variables must be dimensioned accordingly. Bridge configuration code for strain gages The bridge configuration code can be entered as a BrConfig positive or negative number: −...
Page 182
Section 8. Processing and Math Instructions 'Program name: STRAIN.DLD Public Count, ZStrain, StMeas, Strain, Flag(8) ' Declare all variables as public 'Data Table STRAINS samples every measurement when user Sets Flag(1) High DataTable(STRAINS,Flag(1),-1) DataInterval(0,0,0,100) 'Interval = Scan, 100 lapses Sample (1,Strain,Ieee4) EndTable 'DataTable ZERO_1 stores the "zero"...
Page 183
Section 8. Processing and Math Instructions Value of number Number returned < 0 The same number every time, as determined by number. > 0 The next random number in the sequence. The number most recently generated. number omitted The next random number in the sequence. The same random-number sequence is generated each time the instruction is encountered because each successive call to the Rnd function uses the previous random number as a seed for the next number in the random-number sequence.
Page 184
Section 8. Processing and Math Instructions Sine Function Returns the sine of an angle. Syntax Sin( angle Remarks The argument angle can be any valid numeric expression measured in radians. The Sin function takes an angle and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite the angle divided by the length of the hypotenuse.
Page 185
Section 8. Processing and Math Instructions Spatial Standard Deviation Used to find the standard deviation of an array. Syntax StdDevSpa( Dest, Swath, Source Remarks Spatial standard deviation. ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ i j swath i j swath ∑ ∑...
Page 186
Section 8. Processing and Math Instructions The XOR function is used to perform a binary logical exclusion on two numbers. Syntax result = number1 XOR number2 The XOR operator also performs a bit-wise comparison of identically positioned bits in two numbers (may be variables or the results of expressions) and sets the corresponding bit in result according to the following truth table: If bit in X is And bit in Y is...
Until the trigger(s) is true, the burst buffer is a ring memory that holds the number of scans specified in the scan instruction. The trigger condition(s) is specified with either the EndBurstTrigger or EndBurstTriggerSequence instruction. EndBurstTriggerSequence is not in CR9000 operating systems prior to OBJ 3.00...
Page 188
Section 9. Program Control Instructions Syntax BeginBurstTrigger [statementblock] EndBurstTrigger(BurstTrigger, ScansAfterTrigger) BeginBurstTrigger [statementblock] EndBurstTriggerSequence (ScansBefore, StartTrigger, StopTrigger, ScansAfterTrigger, FillandStop ) The BeginBurstTrigger... EndBurstTrigger(...) statement has these parts: Part Description BeginBurstTrigger Marks the start of the instructions that must be processed to test the Burst Trigger. Statementblock Typically this would consist of the measurement to be tested for the trigger.
Page 189
Once the burst is complete, the CR9000 loops through the instructions in the scan the number of times specified in the count, pulling data for measurements from the burst buffer.
Page 190
Section 9. Program Control Instructions Parameter Enter & Data Type This is an optional parameter on the BeginBurstTrigger instruction. If set to 1 the measurements or Process calculations within BeginBurstTrigger … EndBurst… will be available to output when the burst is empty or 1 complete.
Page 192
Section 9. Program Control Instructions Call The Call statement is used to transfer program control from the main program to a subroutine. Syntax Call Name(List of Variables) Remarks Use of the Call keyword when calling a subroutine is optional. The Call statement has these parts: Part Description Call...
Page 193
Next I ClockSet (Source). Sets the CR9000 clock from the values in an array. The most likely use for this is where the CR9000 can input the time from a more accurate clock than its own (e.g., a GPS receiver). The input time would periodically or conditionally be converted into the required variable array and ClockSet would be used to set the CR9000 clock.
Page 194
Section 9. Program Control Instructions Delay Used to delay the program. Syntax Delay( Delay, Units Remarks Delay processing the specified time before continuing. Parameter Enter & Data Type The time to delay before continuing with the next measurement. Delay Constant The units for the delay.
Page 195
Section 9. Program Control Instructions condition Numeric expression that evaluates true (nonzero) or false (0 or Null). statementblock Program lines between the Do and Loop statements that are repeated while or until condition is true. Exit Do Only used within a Do...Loop control structure to provide an alternate way to exit a Do...Loop.
Page 196
FileManage is a function that allows a running DLD program to manipulate files that are stored in the CR9000. "d:FileName" is the device and name of the file that must have previously been stored in the CR9000. The device must be CPU: or a possible Pam device such as P4A:.
Page 197
Section 9. Program Control Instructions The For...Next statement has these parts: Part Description Begins a For...Next loop control structure. Must appear before any other part of the structure. counter Numeric variable used as the loop counter. The variable cannot be an array element or a record element. start Initial value of counter.
Page 198
Section 9. Program Control Instructions Note If you omit the variable in a Next statement, the value of Step increment is added to the variable associated with the most recent For statement. If a Next statement is encountered before its corresponding For statement, an error occurs.
Page 199
Section 9. Program Control Instructions The thenpart and the elsepart fields both have this syntax: {statements | [GoTo] linenumber | GoTo linelabel } The thenpart and elsepart syntax has these parts: Part Description statements One or more CRBasic statements, separated by colons. Note You can have multiple statements with a condition, but they must be on the same line and separated by colons, as in the...
Page 200
Section 9. Program Control Instructions The Else and ElseIf clauses are both optional. You can have as many ElseIf clauses as you like in a block If, but none can appear after an Else clause. Any of the statement blocks can contain nested block If statements. CRBasic looks at what appears after the Then keyword to determine whether or not an If statement is a block If.
Page 201
Remarks This instruction sets a time to power up and then shuts off CR9000 power. Only the clock continues running while the CR9000 is powered down. When the time to power up arrives, the power is restored, the CR9000 reloads its program from Flash memory and begins running.
Page 202
Power off can also be used in conjunction with the digital inputs on the 9011 Power Supply Board to set up the CR9000 to power up in response to external trigger, make a series of measurements, and then power off.
Page 203
TEMPS.DLD from CPU flash memory and run it. Whatever DLD file is currently run on power up would be loaded and run if the CR9000 was powered off and then on again. In the above example, the attribute parameter is entered as a binary number (&B100);...
Page 204
Section 9. Program Control Instructions Reset Table Used to reset a data table under program control. Syntax ResetTable( TableName Remarks ResetTable is a function that allows a running DLD program to reset a data table. TableName is the name of the table to reset. ResetTable Example The example program line uses ResetTable to reset table MAIN when Flag(2) is high.
Page 205
Section 9. Program Control Instructions Remarks The measurements, processing, and calls to output tables bracketed by the Scan and NextScan instructions determine the sequence and timing of the datalogging. The Scan instruction determines how frequently the measurements within the scan are made: The Scan instruction has four parameters.
Page 206
Section 9. Program Control Instructions clause, only the statements following the first match are executed. Case Sets apart a group of CRBasic statements to be executed if an expression in expressionlist matches testexpression. expressionlist The expressionlist consists of a comma-delimited list of one or more of the following forms.
Page 207
It is possible to have a scan in the SlowSequence for measurements that are needed at a slower rate of the primary scan interval. The CR9000 tags on measurement instructions from the slow sequence scan to the normal scan as time allows.
Page 208
Processing instructions within the slow sequence are executed in the time available after processing in the main program is completed. SlowSequence Example The example uses SlowSequence to calibrate the CR9000 every ten seconds. SlowSequence Scan(10 Secs, 0, 0) Calibrate...
Page 209
Counter - Timer / Digital I/O Module matches the specified word. It should be noted that the CR9000 time stamp is clocked by the scan. Thus, if the scan rate is set at 2 seconds, but the trigger is activated every 4 seconds, the time stamp will still increment only 2 seconds every time the trigger activates the scan (increment value will be off by a factor of 2).
Page 210
The Scan interval is entered as a negative number to tell the CR9000 that it is to use an external scan trigger input. It should be noted that the CR9000 time stamp is clocked by the scan.
Appendix A. Keywords and Predefined Constants The following is a list of keywords and predefined constants in CRBasic. These keywords are not case sensitive and must not be used as variable names. It is possible to use a keyword as part of a variable name if there are additional letters preceding or following the letters that make up the keyword.
Page 212
Appendix A. Keywords and Predefined Constants Long =20, predefined constant SDMSpeed measurement Loop program control SDMTrigger measurement LowPriority program control =2, predefined constant Maximum output processing Select program control MaxSpa processing SerialInput measurement MemoryTest calibration SetDac calibration =3, predefined constant function Minimum output processing...
Page 213
CR9000 Index Common Mode Range, 1-9, 3-4 Connectors, 1-1 Const Instruction, 5-1 Constant Declaration, 5-1 ABS, Absolute Value Instruction, 8-1 Continuous Analog Output, 7-10 AC Excitation, 3-17 Control Ports, Setting, 7-21 Alias, 4-4, 4-8, 5-1 Convert Data File, 2-8 AM25T Instruction, 7-12...
Page 215
CR9000 Index Maximum Output Instruction, 6-21 Parameter Types, 4-8 Maximum, local, 8-17 PC Card Instruction, 6-8 MaxSpa, Spatial Maximum Instruction, 8-13 PC Card, 2-1 Measurements PC9000 Application Software, OV-10 Analog Voltage Sequence, 3-1 PeakValley Instruction, 8-17 Common Mode Check (R Option), 3-5...
Page 216
CR9000 Index Select Case, 9-20 True, 4-7 Serial Input/Output, 7-21 TypeT, 3-9, 3-10 Sgn Function - Sign of Number, 8-25 SIN, Sine Function, 8-26 Single Ended Voltage Measurement, 7-3 SIO4 Instruction, 7-21 Units Declaration, 5-3 SlowSequence Instruction, 9-22 Until, 9-9...
Page 218
Campbell Scientific Companies Campbell Scientific, Inc. (CSI) 815 West 1800 North Logan, Utah 84321 UNITED STATES www.campbellsci.com info@campbellsci.com Campbell Scientific Africa Pty. Ltd. (CSAf) PO Box 2450 Somerset West 7129 SOUTH AFRICA www.csafrica.co.za sales@csafrica.co.za Campbell Scientific Australia Pty. Ltd. (CSA)
Need help?
Do you have a question about the CR9000 and is the answer not in the manual?
Questions and answers