Campbell CR5000 Operator's Manual - 1.10  Maintenance

Summary of CR5000

  • Page 1

    Cr5000 measurement and control system revision: 11/06 c o p y r i g h t © 2 0 0 0 - 2 0 0 6 c a m p b e l l s c i e n t i f i c , i n c ..

  • Page 2: Warranty and Assistance

    Warranty and assistance the cr5000 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. Campb...

  • Page 3

    I cr5000 measurement and control system table of contents pdf viewers note: these page numbers refer to the printed version of this document. Use the adobe acrobat® bookmarks tab for links to specific sections. Page ov1. Physical description ov1.1 measurement inputs ....................................

  • Page 4

    Cr5000 table of contents ii 3. Cr5000 measurement details 3.1 analog voltage measurement sequence .............................................................................. 3-1 3.2 single ended and differential voltage measurements .......................................................... 3-4 3...

  • Page 5: Cr5000 Overview

    Ov-1 cr5000 overview the cr5000 provides precision measurement capabilities in a rugged, battery-operated package. The system makes measurements at a rate of up to 5,000 samples/second with 16-bit resolution. The cr5000 includes cpu, keyboard display, power supply, and analog and digital inputs and ...

  • Page 6

    Cr5000 overview ov-2 ground lug cs i/o computer rs-232 (optically isolated) g 12v h l 1 2 1 h l 3 4 2 h l 5 6 3 h l 7 8 4 h l 9 10 5 h l 11 12 6 h l 13 14 7 h l 15 16 8 h l 17 18 9 h l 19 20 10 diff se h l 21 vx1 vx2 vx3 vx4 cao1 cao2 ix1 ix2 ix3 ix4 ixr p1 p2 c1 c2 c3 c4 22 11 g c5 c6 c7 c8 g >2.0v...

  • Page 7

    Cr5000 overview ov-3 ov1.1.2 signal grounds ( ) the signal grounds ( ) should be used as the reference for single-ended analog inputs, excitation returns, and sensor shield wires. Signal returns from the cao and pulse channels should use the terminals located on the cao and pulse terminal strip to m...

  • Page 8

    Cr5000 overview ov-4 ov1.1.10 control i/o there are 8 digital input/output channels (0 v low, 5 v high) for frequency measurement, digital control, and triggering. Ov1.1.11 pulse inputs two pulse input channels can count pulses from high-level (5 v square wave), switch closure, or low-level a/c sign...

  • Page 9

    Cr5000 overview ov-5 ov1.3 power supply and ac adapter the cr5000 has two base options the low profile without any power supply and the lead acid battery power supply base. The low profile base requires an external dc power source connected to the power in terminal on the panel. The battery base has...

  • Page 10

    Cr5000 overview ov-6 ov2.3 data tables the cr5000 can store individual measurements or it may use its extensive processing capabilities to calculate averages, maxima, minima, histogams, ffts, etc., on periodic or conditional intervals. Data are stored in tables such as listed in table ov2-1. The val...

  • Page 11

    Cr5000 overview ov-7 you may use the default directory of pc9000 or install the software in a different directory. The directory will be created for you. To abort the installation, type ctrl-c or break at any time. Ov3.3 pc9000 software overview this overview points out the main pc9000 functions and...

  • Page 12

    Cr5000 overview ov-8 ov3-1. Pc9000 primary functions file edit realtime analysis tools collect display windows help cr9000 program generator cr5000 program generator cr9000 program editor . . . Cr5000 program editor . . . Open wiring diagram . . . Open data table info file . . . Open data file . . ....

  • Page 13

    Cr5000 overview ov-9 ov3-2. Pc9000 editing, help, and user preferences ov3.3.1 file program generator guides the user through a series of menus to configure the measurement types: thermocouple, voltage, bridge, pulse counting, frequency, and others. Creates a cr5000 program, wiring diagram, output t...

  • Page 14

    Cr5000 overview ov-10 virtual oscilloscope displays up to six channels. Time base variable from milliseconds to hours. X-y plotter allows comparison of any two measurements in real time. Ov3.3.3 analysis data graphing displays up to 16 fields simultaneously as strip charts or two multi-charts with u...

  • Page 15: Ov4.  Keyboard Display

    Cr5000 overview ov-11 ov4. Keyboard display campbell scientific cr5000 datalogger 06/18/2000, 18:24:35 cpu: trig.Cr5 running. Real time tables real time custom final storage data reset data tables graph setup data run/stop program file status configure, settings rom version : xxxx os version : xxxx ...

  • Page 16

    Cr5000 overview ov-12 ov4.1 data display data run/stop program file status configure, settings list of data tables created by active program list of data tables created by active program real time tables real time custom final storage data reset data table graph setup graph type: scope scaler: manua...

  • Page 17

    Cr5000 overview ov-13 ov4.1.1 real time tables table1 temps public tref : 23.0234 tctemp(1) : 19.6243 tctemp(2) : 19.3429 tctemp(3) : 21.2003 flag(1) : -1.0000 flag(2) : 0.00000 flag(3) : 0.00000 flag(4) : 0.00000 scaler manual upper: 30.000000 lower: 20.000000 display val on display max on display ...

  • Page 18

    Cr5000 overview ov-14 ov4.1.2 setting up real time custom display table1 temps public tref tctemp(1) tctemp(2) tctemp(3) flag(1) flag(2) flag(3) flag(4) tctemp(3) : 24.9496 : : : : : : list of data tables created by active program. For example, cursor to desired table and press enter tctemp(3) new v...

  • Page 19

    Cr5000 overview ov-15 ov4.1.3 final storage tables press ins for jump to screen. Timestamp record tref tc(1) tc(2) tc(3) "2000-01-03 00:12:38" 0 21.934 22.8419 "2000-01-03 00:12:39" 1 24.1242 21.8619 21.9173 22.8364 "2000-01-03 00:12:40" 2 24.1242 21.8786 21.9229 22.8364 "2000-01-03 00:12:41" 3 24.1...

  • Page 20

    Cr5000 overview ov-16 ov4.2 run/stop program pccard display data run/stop program file status configure, settings you may now remove the card. Cr5000 closes tables first. All card data will be lost! Proceed? Yes no remove card format card table status card status pc card status: battery ok 5volt car...

  • Page 21

    Cr5000 overview ov-17 ov4.3 file display new edit copy delete run options directory format cpu: all programs and other files will be lost! Proceed? Yes list of programs no data run/stop program file status configure, settings new file name: cpu: .Cr5 crd: .Cr5 cpu: crd: copy from to execute cursor t...

  • Page 22

    Cr5000 overview ov-18 ov4.3.1 file: edit the program editor in pc9000 is recommended for writing and editing datalogger programs. Changes in the field can be made with the keyboard display. Press ins esc cpu: tctemp.Cr5 0 race.Cr5 0 cr5000 ' tctemp.Cr5 public tref,tc(3),flag(8) d atatable (temps,1,1...

  • Page 23

    Cr5000 overview ov-19 ov4.4 configure display data run/stop program file status configure, settings light dark * -> 05/24/2000, 15:10:40 year 2000 month 5 day 24 hour 15 minute 10 set cancel cursor to configure, settings and press enter set time/date settings display security enable rs-232 time out:...

  • Page 24: Ov5.  Specifications

    Cr5000 overview ov-20 ov5. Specifications program execution rate the cr5000 can measure one channel and store the result in 500 µs; all 40 se* channels can be measured in 8 ms (5 khz aggregate rate). Analog inputs description: 20 df* or 40 se, individually configured. Channel expansion provided thro...

  • Page 25: 1.2  Power Requirements

    1-1 section 1. Installation and maintenance 1.1 protection from the environment the normal environmental variables of concern are temperature and moisture. The standard cr5000 is designed to operate reliably from -25 to +50°c (-40°c to +85°c, optional) in noncondensing humidity. When humidity tolera...

  • Page 26: 1.3  Cr5000 Power Supplies

    Section 1. Installation and maintenance 1-2 1.3 cr5000 power supplies the cr5000 may be purchased with either a rechargeable lead acid battery or with a low profile case without a battery. While the cr5000 has a wide operating temperature range (-40 to +85°c optional), the lead acid battery base is ...

  • Page 27

    Section 1. Installation and maintenance 1-3 black red white 6v 7ah lead acid battery 6v 7ah lead acid battery lead acid battery replacement - - + + figure 1.3-1. Lead acid battery wiring monitor the power supply using datalogger instruction “ battery” . Incorporate this instruction into data acquisi...

  • Page 28: 1.4  Solar Panels

    Section 1. Installation and maintenance 1-4 1.3.2 low profile cr5000 the low profile cr5000 option is not supplied with a battery base. See section 1.5 and 1.6 for external power connection considerations. 1.4 solar panels auxiliary photovoltaic power sources may be used to maintain charge on lead a...

  • Page 29

    Section 1. Installation and maintenance 1-5 caton dc onl sn logan tah ade n sa cr5000 easurement and control system h l 1 diff 1 2 h l 2 3 4 h l 3 5 6 h l 4 7 8 h l 5 9 10 h l 6 11 12 h l 7 13 14 h l 8 15 16 h l 9 17 18 h l 10 c s i/o (o p tic a lly iso la te d ) r s -232 c o p t e r 19 20 se h l 11...

  • Page 30

    Section 1. Installation and maintenance 1-6 1.6.2 cr5000 with low profile base (no battery) if a cr5000 without batteries is to be powered from the 12 volts of a motor vehicle, a second 12 v supply is required. When the starting motor of a vehicle with a 12 v electrical system is engaged, the voltag...

  • Page 31

    Section 1. Installation and maintenance 1-7 h l 1 2 1 h l 3 4 2 h l 5 6 3 h l 7 8 4 h l 9 10 5 h l 11 12 6 h l 13 14 7 h l 15 16 8 h l 17 18 9 h l 19 20 10 diff se h l 21 vx1 vx2 vx3 vx4 cao1 cao2 ix1 ix2 ix3 ix4 ixr p1 p2 c1 c2 c3 c4 22 11 g c5 c6 c7 c8 g >2.0v g >0.8v 5v 5v g sdi-12 12v g sdm-c1 s...

  • Page 32

    Section 1. Installation and maintenance 1-8 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 componen...

  • Page 33

    Section 1. Installation and maintenance 1-9 1.7.3 effect of grounding on single-ended measurements low-level single-ended voltage measurements can be problematic because of ground potential fluctuations. The grounding scheme in the cr5000 has been designed to eliminate ground potential fluctuations ...

  • Page 34

    Section 1. Installation and maintenance 1-10 table 1.8-1 current sourcing limits terminals current source limit sw12 12v + sw12 5v + csi/o make certain that the primary source of power for the cr5000 can sustain the current drain for the period of time required. Contact a csi applications engineer f...

  • Page 35

    Section 1. Installation and maintenance 1-11 1.9.1 use of digital i/o ports for switching relays each of the eight digital i/o ports can be configured as an output port and set low or high (0 v low, 5 v high) using the portset or writeio instructions. A digital output port is normally used to operat...

  • Page 36: 1.10  Maintenance

    Section 1. Installation and maintenance 1-12 figure 1.9-2. Power switching without relay 1.10 maintenance the cr5000 power supplies require a minimum of routine maintenance. When not in use, the rechargeable supply should be stored in a cool, dry environment with the ac charger active. 1.10.1 desicc...

  • Page 37

    Section 1. Installation and maintenance 1-13 while powered from an external source, the cr5000 measures the voltage of the lithium battery daily. This voltage is displayed in the status table (section 1.6) a new battery will have approximately 3.6 volts. The cr5000 status table has a “ lithium batte...

  • Page 38

    Section 1. Installation and maintenance 1-14 the new cell is placed into the battery holder, observing the polarity markings on the holder. Replace the band clamp, ensuring that both ends snap securely into the battery holder. B a t t e r y 2 (datalogger/cr5 000) s a n y o figure 1.10-5. Loosening o...

  • Page 39

    Section 1. Installation and maintenance 1-15 s a n y o figure 1.11-6. Removal of band clamp and battery..

  • Page 40

    Section 1. Installation and maintenance 1-16 this is a blank page..

  • Page 41: 2.1  Data Storage In Cr5000

    2-1 section 2. Data storage and retrieval the cr5000 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. For simplicity, the pc9000 progra...

  • Page 42: 2.2  Internal Data Format

    Section 2. Data storage and retrieval 2-2 when a new program is compiled that sends data to the pc card, the cr5000 checks if a card is present and if the card has adequate space for the data tables. If the card has adequate space, the tables will be allocated and the cr5000 will start storing data ...

  • Page 43: 2.3  Data Collection

    Section 2. Data storage and retrieval 2-3 table 2.2-3 fp2 decimal location absolute value decimal location 0 - 7.999 x.Xxx 8 - 79.99 xx.Xx 80 - 799.9 xxx.X 800 - 7999. Xxxx. 2.3 data collection data can be transferred into a computer using pc9000 via a communications link or by transferring a pc car...

  • Page 44

    Section 2. Data storage and retrieval 2-4 figure 2.3.1. Collect data dialog box 2.3.1.1 file type ascii with time – click here to store the data as an ascii (toa5, section 2.4) file. Each record will be date and time stamped. Binary with time – click here to store the data as a binary file (tob1, se...

  • Page 45

    Section 2. Data storage and retrieval 2-5 since last, create new file – click here to save new data in a new file. Pc9000 searches for the last file with the root name, gets the last record number from that file, then the current record from the table in the cr5000, and requests all records in betwe...

  • Page 46

    Section 2. Data storage and retrieval 2-6 when the file collection options that create a new file are used, each time a table is collected, the 2 digit number is incremented (e.G., events00.Dat, events01.Dat, events03.Dat ...). Pc9000 searches the selected directory and adds 1 to the number of the h...

  • Page 47

    Section 2. Data storage and retrieval 2-7 2.3.3 logger files retrieve logger files under the pc9000 tools menu allows the user to check the programs stored in cpu flash memory and the files stored on the pcmcia cards. Any of the files shown in logger files can be copied to the computer by highlighti...

  • Page 48

    Section 2. Data storage and retrieval 2-8 from the cr5000. When a new program is compiled that sends data to the pc card, the cr5000 checks if a card is present and if the card has adequate space for the data tables. If the card has adequate space, the tables will be allocated and the cr5000 will st...

  • Page 49

    Section 2. Data storage and retrieval 2-9 when the pc card is inserted in a computer, the data files can be copied to another drive or used directly from the pc card just as one would from any other disk. In most cases, however, it will be necessary to convert the file format before using the data. ...

  • Page 50

    Section 2. Data storage and retrieval 2-10 "file format","station","logger","serial no.","os ver","dld file","dld sig","table name" "timestamp","record","field name","field name","field name" "ts","rn","field units","field units","field units" "","","processing","processing","processing" "field data...

  • Page 51

    Section 2. Data storage and retrieval 2-11 field name the name of the field in the data table. This name is created by the cr5000 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 p...

  • Page 52

    Section 2. Data storage and retrieval 2-12 the following is an example of how the above data might look when imported into a spread sheet. Toa5 bob's9k cr5000 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 a...

  • Page 53

    Section 2. Data storage and retrieval 2-13 stamped, allowing the calculation of time stamps for their records. If there is a lapse in periodic interval records that does not occur on a frame boundary, an additional time stamp is written within the frame and its occurrence noted in the frame boundary...

  • Page 54

    Section 2. Data storage and retrieval 2-14 this is a blank page..

  • Page 55

    3-1 section 3. Cr5000 measurement details 3.1 analog voltage measurement sequence the cr5000 measures analog voltages with either an integrate and hold or a sample and hold analog to digital (a/d) conversion. The a/d conversion is made with a 16 bit successive approximation technique which resolves ...

  • Page 56

    Section 3. Cr5000 measurement details 3-2 an autorange measurement will return not-a-number if the voltage exceeds the range picked by the first measurement. To avoid problems with a signal on the edge of a range, autorange selects the next larger range when the signal exceeds 90% of a range. Autora...

  • Page 57

    Section 3. Cr5000 measurement details 3-3 3.1.4 settlingtime when the cr5000 switches to a new channel or switches on the excitation for a bridge measurement, there is a finite amount of time required for the signal to reach its true value. Delaying between setting up a measurement (switching to the...

  • Page 58: Measurements

    Section 3. Cr5000 measurement details 3-4 multiple of 500 µs, the cr5000 will repeat 250 µs integration measurements every 500 µ s throughout the integration interval. If the integration time specified is 100 µs or 200 µs, the cr5000 makes one or two samples in the integration interval. The average ...

  • Page 59: 3.3  Signal Settling Time

    Section 3. Cr5000 measurement details 3-5 be made. For example, if the high side of a differential input is at 4 v and the low side is at 3 v relative to cr5000 ground, there is no problem. A measurement made on the ± 5000 mv range will return 1000 mv. However, if the high input is at 5.8 v and the ...

  • Page 60

    Section 3. Cr5000 measurement details 3-6 1. The signal must rise to its correct value. 2. A small transient caused by switching the analog input into the measurement circuitry must settle. 3. When a resistive bridge measurement is made using a switched excitation channel, a larger transient caused ...

  • Page 61

    Section 3. Cr5000 measurement details 3-7 measurements are repeated on the same channel the settling time is only necessary before the first measurement (as long as the excitation polarity and differential inputs are not reversed). Before the program to measure the settling time is run, the sensor w...

  • Page 62

    Section 3. Cr5000 measurement details 3-8 junction, which becomes the reference junction, is formed where the other ends of the wires are connected to the measuring device. (with the connectors at the same temperature, the chemical dissimilarity between the thermocouple wire and the connector does n...

  • Page 63

    Section 3. Cr5000 measurement details 3-9 0 0.05 0.1 0.15 0.2 0.25 0.3 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90 100 temperature ºc thermistor tolerance ºc figure 3.4-1. Thermistor tolerance the error in the reference temperature measurement is a combination of the error in the thermistor...

  • Page 64

    Section 3. Cr5000 measurement details 3-10 thermal mass of the batteries. Note that the smallest errors are on channels 5 and 16 in the middle of the terminal strips closest to the thermistor. Reference temperature errors due to panel gradient chamber changed from -55 to 80 °c at maximum rate -7 -6 ...

  • Page 65

    Section 3. Cr5000 measurement details 3-11 reference temperature errors due to panel gradient chamber changed from 80 to 25 °c at 1.3 °c/minute -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 -5 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 time (minutes) measured - actual (°c) 20 30 40 50 60 70 8...

  • Page 66

    Section 3. Cr5000 measurement details 3-12 when both junctions of a thermocouple are at the same temperature there is no voltage produced (law of intermediate metals). A consequence of this is that a thermocouple can not have an offset error; any deviation from a standard (assuming the wires are eac...

  • Page 67

    Section 3. Cr5000 measurement details 3-13 requiring the ±200 mv input range. At 1300 o c, a k thermocouple outputs 34.9 µv per o c. The possible slope error in the voltage measurement is 0.00075x52 mv = 39 µv or 1.12 o c (39/34.9). The basic resolution on the 200 mv range is 6.67 µv or 0.19 o c. Th...

  • Page 68

    Section 3. Cr5000 measurement details 3-14 table 3.4-3. Limits of error on cr5000 thermocouple polynomials (relative to nist standards) tc type range o c limits of error o c t -270 to 400 -270 to -200 + 18 @ -270 -200 to -100 ± 0.08 -100 to 100 ± 0.001 100 to 400 ± 0.015 j -150 to 760 ± 0.008 -100 t...

  • Page 69

    Section 3. Cr5000 measurement details 3-15 table 3.4-4. Reference temperature compensation range and polynomial error relative to nist standards tc type range o c limits of error o c t -100 to 100 ± 0.001 j -150 to 296 ± 0.005 e -150 to 206 ± 0.005 k -50 to 100 ± 0.01 error summary the magnitude of ...

  • Page 70

    Section 3. Cr5000 measurement details 3-16 the box to the cr5000. Alternatively, the junction box can be used to couple extension grade thermocouple wire to the thermocouples, and the cr5000 panel temperature used as the reference. Extension grade thermocouple wire has a smaller temperature range th...

  • Page 71

    Section 3. Cr5000 measurement details 3-17 3.5 bridge resistance measurements there are six bridge measurement instructions included in the standard cr5000 software. Figure 3.5-1 shows the circuits that would typically be measured with these instructions. In the diagrams, the resistors labeled r s w...

  • Page 72

    Section 3. Cr5000 measurement details 3-18 brhalf4w h l h l x = result w/mult = 1, offset = 0 x v v r r s f = = 2 1 r r x r r x s f f s = = / brfull h l x = result w/mult = 1, offset = 0 x 1000 v 1 vx 1000 r 3 r 3 r 4 r 2 r 1 r 2 = = + − + ( ) ( ) x x r r r r r x x r r x x 1 3 3 4 1 2 1 1 2 1 1 1 10...

  • Page 73

    Section 3. Cr5000 measurement details 3-19 3.6 measurements requiring ac excitation 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 with these sensors can resul...

  • Page 74

    Section 3. Cr5000 measurement details 3-20 for excitation; because it is encircled by the ground electrode, the path for a ground loop through the soil is greatly reduced. Moisture blocks which consist of two parallel plate electrodes are particularly susceptible to ground loop problems. Similar con...

  • Page 75: 3.8  Self Calibration

    Section 3. Cr5000 measurement details 3-21 the resolution gets much worse with the shorter intervals used with higher speed measurements. As an example, assume that engine rpm is being measured from a signal that outputs 30 pulses per revolution. At 2000 rpm, the signal has a frequency of 100 hz (20...

  • Page 76

    Section 3. Cr5000 measurement details 3-22 background calibration will be disabled (even if the scan is not executed). The calibrate instruction is described in section 7. The self calibration does not take place if there is not enough time to run it or if the calibrate instruction is in the cr5000 ...

  • Page 77: Programming

    4-1 section 4. Crbasic - native language programming the cr5000 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 n...

  • Page 78: 4.2  Programming Sequence

    Section 4. Crbasic - native language programming 4-2 paneltemp is the keyword name of the instruction. The two parameters associated with paneltemp are: destination, the name of the variable in which to put the temperature; and integration, the length of time to integrate the measurement. To place t...

  • Page 79

    Section 4. Crbasic - native language programming 4-3 define subroutines if there is a process or series of calculations that need to be repeated several times in the program, it can be packaged in a subroutine and called when needed rather than repeating all the code each time. Program the program s...

  • Page 80: 4.3  Example Program

    Section 4. Crbasic - native language programming 4-4 4.3 example program const revdiff=1 const del=0 'default const integ=250 const mult=1 const offset=0 public reftemp public tc(6) units reftemp=degc units tc=degc datatable (temp,1,2000) datainterval (0,100,msec,10) average (1,reftemp,fp2,0) averag...

  • Page 81

    Section 4. Crbasic - native language programming 4-5 = degc). The units are strictly for the user's documentation; the cr5000 makes no checks on their accuracy. The above table is the result of the data table description in the example program: datatable (temp,1,2000) datainterval(0,10,msec,10) aver...

  • Page 82

    Section 4. Crbasic - native language programming 4-6 average(reps, source, datatype, disablevar) average(1,reftemp,fp2,0) average(6,tc(1),fp2,0) average is an output processing instruction that will output the average of a variable over the output interval. The parameters are repetitions - the numbe...

  • Page 83: 4.4  Numerical Entries

    Section 4. Crbasic - native language programming 4-7 forever (or until exitscan). In the example the scan is 1 millisecond, three scans are buffered, and the measurements and output continue indefinitely. 4.4 numerical entries in addition to entering regular base 10 numbers there are 3 additional wa...

  • Page 84: 4.6  Flags

    Section 4. Crbasic - native language programming 4-8 4.5.2 expression evaluation conditional tests require the cr5000 to evaluate an expression and take one path if the expression is true and another if the expression is false. For example: if x>=5 then y=0 will set the variable y to 0 if x is great...

  • Page 85: 4.7  Parameter Types

    Section 4. Crbasic - native language programming 4-9 4.7 parameter types instructions parameters allow different types of inputs these types are listed below and specifically identified in the description of the parameter in the following sections or in pc9000 crbasic help. Constant variable variabl...

  • Page 86

    Section 4. Crbasic - native language programming 4-10 calibrated sensors, applying the correct calibration to each sensor. If the multiplier and offset are not arrays, the same multiplier and offset are used for each repetition. Voltse(dest,reps,range,aslot,sechan,delay, integ,mult,offset) 'calibrat...

  • Page 87

    Section 4. Crbasic - native language programming 4-11 tablename.Eventend(1,1) is only valid for a data table using the dataevent instruction, tablename.Eventend(1,1) = 1 if the last record of an event occurred the last time the table was called, = 0 if the data table did not store a record or if it ...

  • Page 88

    Section 4. Crbasic - native language programming 4-12 this is a blank page..

  • Page 89

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

  • Page 90

    Section 5. Program declarations 5-2 const declaration example the example uses const to define the symbolic constant pi. Const pi = 3.141592654 'define constant. Dim area, circum, radius 'declare variables. Radius = volt( 1 ) 'get measurement. Circum = 2 * pi * radius 'calculate circumference. Area ...

  • Page 91

    Section 5. Program declarations 5-3 public declaration example the example shows the use of the public declaration. Dim x( 3 ), y, z( 2, 3, 4 ) public x, y, z public dim x( 3 ), y, z( 2, 3, 4 ) 'dim is optional public x( 3 ),y, z( 2, 3, 4 ) public w station name sets the station name. Syntax station...

  • Page 92

    Section 5. Program declarations 5-4 the sub statement has these parts: part description sub marks the beginning of a subroutine. 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 ...

  • Page 93

    Section 5. Program declarations 5-5 subroutine example 'cr5000 'declare variables used in program: public reft, tc(4),prtresist,prttemp,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) average (1,prttemp,fp2,0) endtable 'same da...

  • Page 94

    Section 5. Program declarations 5-6 this is a blank page..

  • Page 95: 6.1  Data Table Declaration

    6-1 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, outpu...

  • Page 96: 6.2  Trigger Modifiers

    Section 6. Data table declarations and output processing instructions 6-2 6.2 trigger modifiers datainterval (tintoint, interval, units, lapses) used to set the time interval for an output table. Datainterval is inserted into a data table declaration following the datatable instruction to establish ...

  • Page 97

    Section 6. Data table declarations and output processing instructions 6-3 parameter & data type enter tintoint constant the time into the interval (offset to the interval) at which the table is to be output. The units for time are the same as for the interval. Interval constant enter the time interv...

  • Page 98

    Section 6. Data table declarations and output processing instructions 6-4 const revdiff 1 'reverse input to cancel offsets const del 0 'use default delay const integ 0 'use no integration public reftemp 'declare the variable used for reference temperature public tc(5) 'declare the variable used for ...

  • Page 99

    Section 6. Data table declarations and output processing instructions 6-5 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 consis...

  • Page 100

    Section 6. Data table declarations and output processing instructions 6-6 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...

  • Page 101

    Section 6. Data table declarations and output processing instructions 6-7 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 eve...

  • Page 102

    Section 6. Data table declarations and output processing instructions 6-8 6.3 export data instructions cardout (stopring, size) used to send output data to the pcmcia card. This instruction creates a data table on the pcmcia card. Cardout must be entered within each data table declaration that is to...

  • Page 103

    Section 6. Data table declarations and output processing instructions 6-9 data transfer to the transmitter can occur via the datalogger's cs i/o port only. The goesdata instruction has the following parameters: when the datalogger sends a command, further processing tasks will be performed only afte...

  • Page 104

    Section 6. Data table declarations and output processing instructions 6-10 parameter & data type enter dataformat the dataformat parameter specifies the format of the data sent to the transmitter constant code description 0 csi fp2 data; 3 bytes per data point 1 floating point ascii; 7 bytes per dat...

  • Page 105

    Section 6. Data table declarations and output processing instructions 6-11 parameter & data type enter statuscomma nd constant the statuscommand specifies the type of information requested from the transmitter. Code description array dim required 0 read time 4 1 status 13 2 last message status 14 3 ...

  • Page 106

    Section 6. Data table declarations and output processing instructions 6-12 where n is the number of values processed over the output interval and x i and y i are the individual values of x and y . Parameter& data type enter numvals constant the number of elements in the array to include in the covar...

  • Page 107

    Section 6. Data table declarations and output processing instructions 6-13 parameter & data type enter units the units for tau. Constant alpha code numeric code units usec 0 microseconds msec 1 milliseconds sec 2 seconds min 3 minutes options a code to indicate what values to calculate and output. C...

  • Page 108

    Section 6. Data table declarations and output processing instructions 6-14 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. • the sum of the ac...

  • Page 109

    Section 6. Data table declarations and output processing instructions 6-15 datatable(ifft,1,1) 'inverse fft fft(y,ieee4,size_fft,10 msec,5) endtable beginprog scan(10, msec,0,size_fft) i=i+1 x(i) = dc + sin(pi/8+2*pi*cyclespert*i/size_fft) * amplitude + sin(pi/2+pi*i) next scan calltable(amp) callta...

  • Page 110

    Section 6. Data table declarations and output processing instructions 6-16 sample(4, temp(1), ieee4) fieldnames “ intaket(2)” the 4 values from the variable array temp are stored in the output table with intaket,an array of 2, and the remainder of the default array temp: intaket(1), intaket(2), temp...

  • Page 111

    Section 6. Data table declarations and output processing instructions 6-17 the difference between the closed and open form is shown in the following example for temperature values: lower range limit 10 ° c upper range limit 30 ° c number of bins 10 closed form open form range of first bin 10 to ° ° ...

  • Page 112

    Section 6. Data table declarations and output processing instructions 6-18 histogram4d (binselect, source, datatype, disablevar, bins1, bins2, bins3, bins4, form, wtval, lolim1, uplim1, lolim2, uplim2, lolim3, uplim3, lolim4, uplim4) processes input data as either a standard histogram (frequency dis...

  • Page 113

    Section 6. Data table declarations and output processing instructions 6-19 levelcrossing (source, datatype, disablevar, numlevels, 2nddim, crossingarray, 2ndarray, hysteresis, option) parameter & data type enter source variable or array the variable that is tested to determine if it crosses the spec...

  • Page 114

    Section 6. Data table declarations and output processing instructions 6-20 processes data with the level crossing counting algorithm. The output is a two dimensional level crossing histogram. One dimension is the levels crossed; the second dimension, if used, is the value of a second input at the ti...

  • Page 115

    Section 6. Data table declarations and output processing instructions 6-21 point source action bin 1 (level=1) bin 2 (level=1.5) bin 3 (level=3) 1 0.5 first value, no counts 0 0 0 2 1.2 add one count to first bin, the signal crossed 1 1 0 0 3 1.4 no levels crossed, no counts 1 0 0 4 0.3 crossed a le...

  • Page 116

    Section 6. Data table declarations and output processing instructions 6-22 point crossing source 2nd dim source action 1 0.5 .7 first value, no counts 2 1.2 1.8 add one count to first crossing, second 2d bin, the signal crossed 1 histogram: 2d 1.25 2.25 cross 1 0 1 0 cross 1.5 0 0 0 cross 3 0 0 0 3 ...

  • Page 117

    Section 6. Data table declarations and output processing instructions 6-23 the hysteresis determines the minimum change in the input that must occur before a crossing is counted. If the value is too small, “ crossings” could be counted which are in reality just noise. For example, suppose 5 is a cro...

  • Page 118

    Section 6. Data table declarations and output processing instructions 6-24 parameter & data type enter datatype a code to select the data storage format. Constant alpha code numeric code data format ieee4 24 ieee 4 byte floating point fp2 7 campbell scientific 2 byte floating point disablevar consta...

  • Page 119

    Section 6. Data table declarations and output processing instructions 6-25 parameter & data type enter form constant the form code is 3 digits - abc code form a = 0 reset histogram after each output. A = 1 do not reset histogram. B = 0 divide bins by total count. B = 1 output total in each bin. C = ...

  • Page 120

    Section 6. Data table declarations and output processing instructions 6-26 c 1,1 c 1,2 . . . C 1,n c 2,1 c 2,2 . . . C 2,n . . . . . . . . . . . . C m,1 c m,2 . . . C m,n the histogram can have either open or closed form. In the open form, a cycle that has an amplitude larger than the maximum bin is...

  • Page 121

    Section 6. Data table declarations and output processing instructions 6-27 parameter & data type enter reps constant the number of standard deviations to calculate. When repetitions are greater than 1, the source must be an array. Source variable the name of the variable that is the input for the in...

  • Page 122

    Section 6. Data table declarations and output processing instructions 6-28 parameter & data type enter repetitions constant the name of the data table to clone. The length of this name should be 4 characters or less so the complete names of the worst case tables are retained when collected (see numc...

  • Page 123

    Section 6. Data table declarations and output processing instructions 6-29 when used with polar sensors, the instruction does a modulo divide by 360 on wind direction, which allows the wind direction (in degrees) to be 0 to 360, 0 to 540, less than 0, or greater than 540. The ability to handle a neg...

  • Page 124

    Section 6. Data table declarations and output processing instructions 6-30 calculations: figure 6.4-2. Input sample vectors in figure 6.4-2, the short, head-to-tail vectors are the input sample vectors described by s i and Θ i , the sample speed and direction, or by ue i and un i , the east and nort...

  • Page 125

    Section 6. Data table declarations and output processing instructions 6-31 resultant mean horizontal wind speed, u : u =(ue 2 +un 2 ) 1/2 figure 6.4-3. Mean wind vector where for polar sensors: ue=( Σ s i sin Θ i )/n un=( Σ s i cos Θ i )/n or, in the case of orthogonal sensors: ue=( Σ ue i )/n un=( ...

  • Page 126

    Section 6. Data table declarations and output processing instructions 6-32 for deviations less than 40 degrees, the error in this approximation is less than 1%. At deviations of 60 degrees, the error is 10%. The speed sample may be expressed as the deviation about the mean speed, s s' s i i = + equa...

  • Page 127

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

  • Page 128

    Section 7. Measurement instructions 7-2 7.8 digital i/o periodavg - measures the period or the frequency of a signal on a single-ended channel.......................................................................... 7-19 portget - reads the status of one of the eight control ports.....................

  • Page 129: 7.1  Voltage Measurements

    Section 7. Measurement instructions 7-3 7.1 voltage measurements voltdiff (dest, reps, range, diffchan, revdiff, settlingtime, integ, mult, offset) sensor diff. Chanel h diff. Chanel l. This instruction measures the voltage difference between the hi and low inputs of a differential channel. Both the...

  • Page 130

    Section 7. Measurement instructions 7-4 tcse (dest, reps, range, sechan, tctype, tref, measofs, settlingtime, integ, mult, offset) s.E. Chanel ground thermocouple this instruction measures a thermocouple with a single-ended voltage measurement and calculates the thermocouple temperature ( °c) for th...

  • Page 131: 7.3  Half Bridges

    Section 7. Measurement instructions 7-5 parameter & data type enter revdiff code value result (reversing requires twice as much time to complete) constant false 0 signal is measured with the high side referenced to the low true ≠0 a second measurement is made after reversing the inputs to cancel off...

  • Page 132

    Section 7. Measurement instructions 7-6 brhalf3w (dest, reps, range, sechan, exchan, measpex, exmv, revex, settlingtime, integ, mult, offset) x = result w/mult = 1, offset = 0 x v v v v r r x s f = − − = 2 2 1 1 this instruction is used to determine the ratio of the sensor resistance to a known resi...

  • Page 133

    Section 7. Measurement instructions 7-7 half bridge parameters parameter & data type enter dest variable or array the variable in which to store the results of the instruction. When reps are used the results are stored in an array with the variable name. An array must be dimensioned to have elements...

  • Page 134: 7.4  Full Bridges

    Section 7. Measurement instructions 7-8 parameter & data type enter settlingtime constant the time in microseconds to delay between setting up a measurement (switching to the channel, setting the excitation) and making the measurement. (1 microsecond resolution) entry voltage range integration settl...

  • Page 135

    Section 7. Measurement instructions 7-9 brfull6w (dest, reps, range1, range2, diffchan, exchan, measpex, exmv, revex, revdiff, settlingtime, integ, mult, offset) x = result w/mult = 1, offset = 0 x v v r r r r r r = = + − + ⎛ ⎝ ⎜ ⎞ ⎠ ⎟ 1000 1000 2 1 3 3 4 2 1 2 this instruction applies an excitation...

  • Page 136

    Section 7. Measurement instructions 7-10 parameter & data type enter exchan enter the excitation channel number to excite the first measurement. Constan alpha code code/ channel result vx1 1 switched excitation channels, are switched to the excitation voltage. Vx2 2 for the measurement and switched ...

  • Page 137: 7.5  Current Excitation

    Section 7. Measurement instructions 7-11 7.5 current excitation resistance (dest, reps, range, diffchan, ixchan, measpex, exua, revex, revdiff, settlingtime, integ, mult,offset) the resistance instruction applies a precision current excitation and measures a differential voltage. The result is the m...

  • Page 138

    Section 7. Measurement instructions 7-12 resistance used to measure full bridge h l ixr ix x = result w/mult = 1, offset = 0 x v i r r r r r r r r r r r r r r r r r x bridge = = + − + ⎛ ⎝ ⎜ ⎞ ⎠ ⎟ = + − + + + + 1 3 3 4 2 1 2 3 1 2 2 3 4 1 2 3 4 ( ) ( ) ( ) r r r x r r r x r r r r x r r r x r r r r x ...

  • Page 139

    Section 7. Measurement instructions 7-13 parameter & data type enter settlingtime constant the time in microseconds to delay between setting up a measurement (switching to the channel, setting the excitation) and making the measurement. (1 microsecond resolution) entry voltage range integration sett...

  • Page 140

    Section 7. Measurement instructions 7-14 parameter & data type enter caochan the cao channel to set. Constant alpha numeric description cao1 1 cao channel 1 cao2 2 cao channel 2 caomv constant or variable the voltage, in millivolts, to apply to the cao channel. The allowable range is ±5000 mv. The v...

  • Page 141: 7.7  Self Measurements

    Section 7. Measurement instructions 7-15 parameter & data type enter exchan enter the excitation channel number to excite the first measurement. Constan alpha code code/ channel result vx1 1 switched excitation channels, are switched to the excitation voltage. Vx2 2 for the measurement and switched ...

  • Page 142

    Section 7. Measurement instructions 7-16 calibrate (dest, allranges) the calibrate instruction places the cr5000 self calibration under program control. Placing the calibrate instruction in the program disables the automatic self calibration that is normally run in the background (section 3.8). The ...

  • Page 143

    Section 7. Measurement instructions 7-17 unless the allranges option is selected, the calibrate instruction only measures the range and integration combinations that occur in the measurements in the program. For the 250 µs and zero integration calibrations multiple measurements are averaged for the ...

  • Page 144

    Section 7. Measurement instructions 7-18 20 250 µsec integrate 1000 mv differential offset 21 250 µsec integrate 1000 mv gain 22 250 µsec integrate 200 mv single ended offset 23 250 µsec integrate 200 mv differential offset 24 250 µsec integrate 200 mv gain 25 250 µsec integrate 50 mv single ended o...

  • Page 145: 7.8  Digital I/o

    Section 7. Measurement instructions 7-19 7.8 digital i/o periodavg (dest, reps, range, sechan, threshold, paoption, cycles, timeout, mult, offset) this instruction measures the period of a signal on any single-ended input channel. The specified number of cycles are timed with a resolution of 70 ns, ...

  • Page 146

    Section 7. Measurement instructions 7-20 is not recommended for small amplitude sensor signals. For sensor amplitudes less than 20 mv pk-pk a dc blocking capacitor, see figure 7.8-1, is recommended to center the signal at cr5000 ground (threshold = 0) because of offset voltage drift along with limit...

  • Page 147

    Section 7. Measurement instructions 7-21 the back-to-back silicon diodes d1 and d2 provide esd protection of capacitor c and the sensor, and also limit the amplitude of large amplitude sensor signals. These diodes clip large amplitude signals to approximately 1.4 v pk-pk which is within the recommen...

  • Page 148

    Section 7. Measurement instructions 7-22 parameter & data type enter dest variable the variable in which to store the result of the instruction. A 1 is stored if the port is high; 0 is stored if the port is low. Port constant the control port number (1-8) for which the status should be obtained. Por...

  • Page 149

    Section 7. Measurement instructions 7-23 pulsecount (dest, reps, pchan, pconfig, poption, mult, offset) sensor pulse channel ground parameter & data type enter dest variable or array the variable in which to store the results of the instruction. When reps are used the results are stored in an array ...

  • Page 150

    Section 7. Measurement instructions 7-24 cr23x pi 20k figure 7.8-1. Conditioning large voltage pulses the maximum input voltage on a pulse channel is ±20 v. Refer to figure 7.8-1 if reducing input voltage is required. • pulse channels maximum input voltage: ±20 v high frequency input • pulse channel...

  • Page 151

    Section 7. Measurement instructions 7-25 switch closure • pulse channels a switch closure is connected between p1..P4 and analog ground. When the switch is open, the cr23x pulls the pulse channel to 5 v through a 100 kohm impedance. When the switch is closed, the pulse channel is pulled to ground. T...

  • Page 152

    Section 7. Measurement instructions 7-26 sw12 the sw12 instruction is used to set a switched 12 volt supply high or low. Syntax sw12( state ) remarks the datalogger has a switched 12 volt output with two terminals. This switched 12 volts is used to provide a continuous 12 volt supply to external per...

  • Page 153

    Section 7. Measurement instructions 7-27 timerio the timerio instruction is used to measure the time between edges (state transitions) or frequency on the digital i/o ports of the datalogger. The timing resolution is 50 nanoseconds. The longest interval that can be timed is 214.7 seconds (2 32 x 50 ...

  • Page 154

    Section 7. Measurement instructions 7-28 parameter & data type enter units the units parameter is used to specify the unit of measure for the timeout period. An alphabetical or numeric code can be entered. Numeric alpha description 0 usec microseconds 1 msec milliseconds 2 sec seconds 3 min minutes ...

  • Page 155: 7.9  Peripheral Devices

    Section 7. Measurement instructions 7-29 7.9 peripheral devices am25t (dest, reps, range, am25tchan, diffchan, tctype, tref, clkport, resport, vxchan, revdiff, settlingtime, integ, mult, offset) this instruction controls the am25t multiplexer. Parameter & data type enter dest variable or array the v...

  • Page 156

    Section 7. Measurement instructions 7-30 parameter & data type enter settlingtime constant the time in microseconds to delay between setting up a measurement (switching to the channel, setting the excitation) and making the measurement. (1 microsecond resolution) entry voltage range integration sett...

  • Page 157

    Section 7. Measurement instructions 7-31 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 initi...

  • Page 158

    Section 7. Measurement instructions 7-32 parameter & data type enter tseg2 the third time segment, tseg2 (the phase segment two), is defined by the tseg2 parameter. The value of tseg2 can be calculated using the equation: t t t seg tseg q 2 2 = / the relative values of tseg1 and tseg2 determine when...

  • Page 159

    Section 7. Measurement instructions 7-33 parameter & data type enter 18 build data frame in sdm-can memory; 4-byte ieee floating point number; least significant byte first. Logical "or" with existing data. 19 transmit data value to the can-bus; unsigned integer, most significant byte first. 20 trans...

  • Page 160

    Section 7. Measurement instructions 7-34 parameter & data type enter 1 sdm-can returns -99999 if a data value is requested by the datalogger and a new value has not been captured from the network since the last request. 2-9 currently not used. C 0 disable i/o interrupts (default). 1 enable i/o inter...

  • Page 161

    Section 7. Measurement instructions 7-35 parameter & data type enter 6 normal; self-test. The sdm-can will perform a successful transmission even if there is no acknowledgment from an external can node. Frames received correctly from an external node are acknowledged. 7 not defined. 8 not defined. 9...

  • Page 162

    Section 7. Measurement instructions 7-36 'set scan rate const period=1 const p_units=2 ' \ \ \ \ \ \ \ \ \ \ \ \ canbus constants / / / / / / / / / / / / '------------------------- physical network parameters ------------ 'set sdm-can to 250k const tquant=4 const tseg1=5 const tseb2=2 '-------------...

  • Page 163

    Section 7. Measurement instructions 7-37 parameter & data type enter source array the array which holds the values that will be sent to the sdm-cd16ac to enable/disable its ports. An sdm-cd16ac has 16 ports; therefore, the source array must be dimensioned to 16 times the number of repetitions (the n...

  • Page 164

    Section 7. Measurement instructions 7-38 parameter & data type enter cs7500cmd the cs7500cmd parameter requests the data to be retrieved from the sensor. The command is sent first to the device specified by the sdmaddress parameter. If the reps parameter is greater than 1, subsequent cs7500s will be...

  • Page 165

    Section 7. Measurement instructions 7-39 parameter & data type enter command commands 90 - 92 send a measurement trigger to the csat3 with the sdm address specified by the sdmaddress argument. The csat3 also sends data to the datalogger. Options 97 - 99 get data after a group trigger, sdmtrigger(), ...

  • Page 166

    Section 7. Measurement instructions 7-40 parameter & data type enter dest variable or array the array where the results of the instruction are stored. For all output options except capture all events, the dest argument should be a one dimensional array with as many elements as there are programmed i...

  • Page 167

    Section 7. Measurement instructions 7-41 parameter & data type enter for example, 4301 in the second function parameter means to return 3 values: the period for channel 1, (nothing for channel 2) the time between an edge on channel 2 and an edge on channel 3, and the time between an edge on channel ...

  • Page 168

    Section 7. Measurement instructions 7-42 parameter & data type enter capturetrig constant, variable, or expression this argument is used when the "capture all events" output option is used. When capturetrig is true, the int8 will return the last nnnn events. Mult, offset constant, variable, array, o...

  • Page 169

    Section 7. Measurement instructions 7-43 parameter & data type enter dest the dest parameter is the variable in which to store the results of the instruction when retrieving data from the sio4. If data is being sent to the sio4, then dest becomes the source array for the data to be sent. The dest ar...

  • Page 170

    Section 7. Measurement instructions 7-44 parameter & data type enter 2049 communication parameters. 2054 set up receive filter. 2304 transmit string and/or data to device (formatter/filter). 2305 transmit bytes. Param1 param1 is the first parameter that should be passed on to the sio4 for the select...

  • Page 171

    Section 7. Measurement instructions 7-45 parameter & data type enter startchan constant the first channel that should be read on the sw8a. If the reps parameter is greater than 1, measurements will be made on sequential channels. Mult, offset constant, variable, array, or expression a multiplier and...

  • Page 172

    Section 7. Measurement instructions 7-46 this is a blank page..

  • Page 173: Instructions

    8-1 section 8. Processing and math instructions operators ^ raise to power * multiply / divide + add - subtract = equals not equal > greater than less than >= greater than or equal less than or equal abs (source) returns the absolute value of a number. Syntax x = abs (source) remarks source can be a...

  • Page 174

    Section 8. Processing and math instructions 8-2 acos (source) the acos function returns the arc cosine of a number. Syntax x = acos (source) remarks the source can be any valid numeric expression that has a value between -1 and 1 inclusive. The acos function takes the ratio of two sides of a right t...

  • Page 175

    Section 8. Processing and math instructions 8-3 if bit in and bit in the result expr1 is expr2 is is 0 0 0 0 1 0 1 0 0 1 1 1 and operator example the example assigns a value to msg that depends on the value of variables a, b, and c, assuming that no variable is a null. If a = 10, b = 8, and c = 6, b...

  • Page 176

    Section 8. Processing and math instructions 8-4 atn (source) returns the arctangent of a number. Syntax x = atn (source) remarks source can be any valid numeric expression. The atn function takes the ratio of two sides of a right triangle and returns the corresponding angle. The ratio is the length ...

  • Page 177

    Section 8. Processing and math instructions 8-5 pi/2 -pi/2 pi 0 +y +x -x -y atn2 is the inverse trigonometric function of tan, which takes an angle as its argument and returns the ratio of two sides of a right triangle. Do not confuse atn2 with the cotangent, which is the simple inverse of a tangent...

  • Page 178

    Section 8. Processing and math instructions 8-6 parameter & data type enter dest variable the variable in which to store the results of the instruction. Swath constant the number of values of the source array to average. Source array the name of the variable array that is the input for the instructi...

  • Page 179

    Section 8. Processing and math instructions 8-7 example beginprog 'program begins here scan( rate, runits, 0, 0 ) 'scan 1(msecs), '______________________ volt blocks ______________________ voltdiff(hivolts, vrep1, vrng1, 5, 1, 0, vdly1, vint1, vmult1, voset1) avgrun(avgout,1,hivolts,100 ) 'put the a...

  • Page 180

    Section 8. Processing and math instructions 8-8 public volt1, ans 'declare variables. Beginprog scan (1,sec,3,0) voltdiff (volt1,1,mv5000,1,true ,200,500,1.0,0) 'return voltage on diffchan1 ans = cosh( volt1 ) nextscan endprog spatial covariance the covspa instruction computes the covariance(s) of s...

  • Page 181

    Section 8. Processing and math instructions 8-9 exp returns e (the base of natural logarithms) raised to a power. Syntax x = exp (source) remarks if the value of the source exceeds 709.782712893, an overflow error occurs. The constant e is approximately 2.718282. The exp function complements the act...

  • Page 182

    Section 8. Processing and math instructions 8-10 parameter & data type enter units the units for tau. Constant alpha code numeric code units usec 0 microseconds msec 1 milliseconds sec 2 seconds min 3 minutes options a code to indicate what values to calculate and output. Constant code result 0 1 2 ...

  • Page 183

    Section 8. Processing and math instructions 8-11 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. • the sum of the ac bins (excluding dc) of th...

  • Page 184

    Section 8. Processing and math instructions 8-12 parameter & data type enter dest array the destination variable array in which to store the fields of the record. The array must be dimensioned large enough to hold all the fields in the record. Tablename name the name of the data table to retrieve th...

  • Page 185

    Section 8. Processing and math instructions 8-13 parameter & data type enter tintoint constant the time into interval sets an offset from the datalogger’s clock to the interval at which the iftime will be true. For example, if the interval is set at 60 minutes, and tintoint is set to 5, iftime will ...

  • Page 186

    Section 8. Processing and math instructions 8-14 if expression1 is and expression2 is the result is true true true true false false true null null false true true false false true false null true null true true null false null null null null the imp operator performs a bitwise comparison of identica...

  • Page 187

    Section 8. Processing and math instructions 8-15 dim a, b, c, d 'declare variables. Beginprog a = int(-99.8) 'returns -100 b = fix(-99.8) 'returns -99 c = int(99.8) 'returns 99 d = fix(99.8) 'returns 99 endprog log (source) returns the natural logarithm of a number. Syntax x = log (source) remarks t...

  • Page 188

    Section 8. Processing and math instructions 8-16 logn( x ) = log10( x ) / log10( n ) log10 function example this example uses the log10 instruction to calculate the log base 2 of 1000. Dim log2_1000 'declare variables. Log2_1000 = log10(1000)/ log10(2) memorytest (dest) stores the results of the mos...

  • Page 189

    Section 8. Processing and math instructions 8-17 maxspa function example this example uses maxspa to find the maximum value of the five elements temp(6) through temp(10) and store the result in the variable maxtemp. Maxspa(maxtemp, 5, temp(6)) minspa (dest, swath, source) finds the minimum value in ...

  • Page 190

    Section 8. Processing and math instructions 8-18 dim testyr, leapstatus 'declare variables. Testyr = 1995 if testyr mod 4 = 0 and testyr mod 100 = 0 then 'divisible by 4? If testyr mod 400 = 0 then 'divisible by 400? Leapstatus = true else leapstatus = false end if elseif testyr mod 4 = 0 then leaps...

  • Page 191

    Section 8. Processing and math instructions 8-19 remarks the following table illustrates how result is determined: if expr is the result is true false false true null null the not operator also inverts the bit values of any variable and sets the corresponding bit in result according to the following...

  • Page 192

    Section 8. Processing and math instructions 8-20 if bit in and bit in the result expr1 is expr2 is is 0 0 0 0 1 1 1 0 1 1 1 1 or operator example the example sets msg that depends on the value of variables a, b, and c, assuming that no variable is a null. If a = 10, b = 8, and c = 11, the left expre...

  • Page 193

    Section 8. Processing and math instructions 8-21 the following example uses sine and cosine signal inputs to illustrate the use of peakvalley with two repetitions. Data table pv1 stores the peaks and valleys from the cosine wave. Pv2 stores the peaks and valleys from the sine wave. Pv3 stores the pe...

  • Page 194

    Section 8. Processing and math instructions 8-22 prt (dest, reps, source, mult, offset) used to calculate temperature from the resistance of an rtd. Syntax prt (dest, reps, source, mult, offset) remarks this instruction uses the result of a previous rtd bridge measurement to calculate the temperatur...

  • Page 195

    Section 8. Processing and math instructions 8-23 realtime used to pick out year, month, day, hour, minute, second, usecond, day of week, and/or day of year from the cr5000 clock. Syntax realtime(dest) remarks realtime example this example uses realtime to place all time segments in the destination a...

  • Page 196

    Section 8. Processing and math instructions 8-24 rectpolar (dest, source) converts from rectangular to polar coordinates. Parameter & data type enter dest variable array variable array in which to store the 2 resultant values. The length of the vector is stored in the specified destination element a...

  • Page 197

    Section 8. Processing and math instructions 8-25 rmsspa (dest, swath, source) 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. ( ) dest x i swath i j i j swath = = = + ∑ ( ) 2 where x(j) = source ...

  • Page 198

    Section 8. Processing and math instructions 8-26 to have the program generate a different random-number sequence each time it is run, use the randomize statement with no number argument to initialize the random-number generator before rnd is called. To produce random integers in a given range, use t...

  • Page 199

    Section 8. Processing and math instructions 8-27 4 full bridge strain gage, 2 gages parallel to +ε , the other 2 parallel to −ε : µε = − 10 6 v gf r 5 full bridge strain gage, half the bridge has 2 gages parallel to +ε and −ε : the other half +νε and −νε : µε ν = − ⋅ + 2 10 1 6 v gf r ( ) code confi...

  • Page 200

    Section 8. Processing and math instructions 8-28 sub zero count = 0 'reset count scan(10,msec,0,100) 'scan 100 times brfull(zstrain,1,mv50,5,1,6,7,1,5000,1,0,0,100,1,0) count = count + 1 'increment counter used by datatable calltable zero_1 'zero_1 outputs on last scan (count=100) next scan zstrain ...

  • Page 201

    Section 8. Processing and math instructions 8-29 here, upperbound is the highest number in the range, and lowerbound is the lowest number in the range. Rnd function example the example uses the rnd function to generate random integer values from 1 to 9. Each time this program is run, randomize gener...

  • Page 202

    Section 8. Processing and math instructions 8-30 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. The result lies in the range -1 to 1. To convert degrees to radians...

  • Page 203

    Section 8. Processing and math instructions 8-31 sqr function example the example uses sqr to calculate the square root of volt(1) value. Dim msg, number 'declare variables. Number = volt(1) 'get input. If number msg = 0 ‘cannot determine the square root of a negative number. Else msg = sqr(number) ...

  • Page 204

    Section 8. Processing and math instructions 8-32 tan function example the example uses tan to calculate the tangent of an angle from a volt(1) input. Dim degrees, pi, radians, ans 'declare variables. Pi = 4 * atn(1) 'calculate pi. Degrees = volt(1) 'get user input. Radians = degrees * (pi / 180) 'co...

  • Page 205

    Section 8. Processing and math instructions 8-33 the xor operator also 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 expr1 is and bit in expr2 is the result is 0 0 0 ...

  • Page 207: Section 9.  Program Control

    9-1 section 9. Program control instructions beginprog, endprog the beginprog instruction is used to mark the beginning of a program. Endprog marks the end of a program. Syntax beginprog ... ... Endprog remarks all of the instructions for the main program fall between the beginprog and endprog statem...

  • Page 208

    Section 9. Program control instructions 9-2 scan (1,sec,3,0) realtime (time) pulsecount (windsp,1,1 ,1,1,1.0,0) pulsecount (rain,1,2,2,0,1.0,0) calltable metdata nextscan endprog call the call statement is used to transfer program control from the main program to a subroutine. Syntax call name(list ...

  • Page 209

    Section 9. Program control instructions 9-3 datatable is called, it will process data as programmed and check the output condition. Calltable example this example uses calltable to call the accel table. Calltable accel data, read, restore used to mark the beginning of a data list. Syntax data list o...

  • Page 210

    Section 9. Program control instructions 9-4 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 cr5000 clock. Source array the source must be a seven element array . Array(1)..Array(7) ...

  • Page 212

    Section 9. Program control instructions 9-6 alternatively, the same thing can be accomplished by incorporating the range test in the do...Loop as follows: dim reply 'declare variable. Do reply = volt(1) loop until reply > 1 and reply the next example show the use of wend. While x > y 'old fashioned ...

  • Page 213

    Section 9. Program control instructions 9-7 filemanage example the statement below uses filemanage to run temps.Cr5, which is stored on the datalogger's cpu, when flag(2) becomes high. If flag(2) then filemanage( "cpu:temps.Cr5" 4 ) '4 means run now filemark (tablename) parameter & data type enter t...

  • Page 214

    Section 9. Program control instructions 9-8 exit for only used within a for...Next control structure to provide an alternate way to exit. Any number of exit for statements may be placed anywhere in the for...Next loop. Often used with the evaluation of some condition (for example, if...Then), exit f...

  • Page 215

    Section 9. Program control instructions 9-9 if ... Then ... Else statement allows conditional execution, based on the evaluation of an expression. Syntax 1 if condition then thenpart [else elsepart] syntax 2 if condition1 then [statementblock-1] [elseif condition2 then [statementblock-2] ] [else [st...

  • Page 216

    Section 9. Program control instructions 9-10 part description if keyword that begins the block if...Then decision control structure. Condition1 same as condition used in the single-line form shown above. Then keyword used to identify the actions to be taken if a condition is satisfied. Statementbloc...

  • Page 217

    Section 9. Program control instructions 9-11 if...Then ... Else statement example the example illustrates the various forms of the if...Then...Else syntax. Dim x, y, temp( 5 ) 'declare variables. X = temp( 1 ) if x then y = 1 '1 digit. Elseif x then y = 2 '2 digits. Else y = 3 '3 digits. End if . . ...

  • Page 218

    Section 9. Program control instructions 9-12 power off can also be used in conjunction with the power-up digital inputs to set up the cr5000 to power up in response to external trigger, make a series of measurements, and then power off. If the "2" input has a voltage greater than 2 volts applied, th...

  • Page 219

    Section 9. Program control instructions 9-13 instruction. The attribute codes are actually a bit field. The codes are as follows: bit decimal description bit 1 2 run on power up bit 2 4 run now rundldfile example the statement below uses rundldfile to run temps.Dld, which is stored on the datalogger...

  • Page 220

    Section 9. Program control instructions 9-14 parameter & data type enter interval constant enter the time interval at which the scan is to be executed. The interval may be in µs, ms, s, or minutes, whichever is selected with the units parameter. The maximum scan interval is one minute. Units the uni...

  • Page 221

    Section 9. Program control instructions 9-15 select case statement executes one of several statement blocks depending on the value of an expression. Syntax select case testexpression [case expressionlist1 [statementblock-1] ] [case expressionlist2 [statementblock-2] ] [case else [statementblock-n] ]...

  • Page 222

    Section 9. Program control instructions 9-16 the argument expressionlist has these parts: part description expression any numeric expression. To keyword used to specify a range of values. If you use the to keyword to indicate a range of values, the smaller value must precede to. Although not require...

  • Page 223

    Section 9. Program control instructions 9-17 sleep the sleep instruction is used to put the datalogger in a quiescent mode between program scans. Syntax sleep remarks this instruction allows the datalogger to go into its lowest current state between program scans. The sleep instruction affects only ...

  • Page 224

    Section 9. Program control instructions 9-18 the minimum time for the slowsequence scan interval is the product of the number of slowsequence measurement segments and the primary scan interval. One function of a slowsequence is to update the calibration table. The measurements in a single "scan" of ...

  • Page 225

    Section 9. Program control instructions 9-19 subscan (subinterval, units, subratio) the subscan instruction is used to control an am16/32 multiplexer or to measure some analog inputs at a faster rate than the program scan. Syntax subscan (subinterval, units, subratio) measurements and processing nex...

  • Page 226

    Section 9. Program control instructions 9-20 'the thermocouples are connected to differential channels 1-6. 'declare variables: public tref, tctemp(6), prtresist(16), prttemp(16) dim i 'counter for setting array element to correct value for mux measurement 'declare output table for 15 minute average...

  • Page 227

    Section 9. Program control instructions 9-21 parameter & data type enter timno constant, variable, or expression an integer number for the timer (e.G., 0, 1, 2, . . .) use low numbers to conserve memory; using timno 100 will allocate space for 100 timers even if it is the only timer in the program. ...

  • Page 228

    Section 9. Program control instructions 9-22 statementblock the statementblock is the portion of the program that should be repeated until the loop is terminated. These instructions lie between the while and wend statements. Wend the wend statement ends the while...Wend control structure. The do...L...

  • Page 229

    A-1 appendix a. Cr5000 status table the cr5000 status table contains current system operating status information that can be accessed from the running cr5000 program or monitored by pc software. There is also a way to view the status information from the keyboard. Table 1 shows the variables in the ...

  • Page 230

    Appendix a. Cr5000 status table a-2 calseoffset integer(array) caldiffoffset integer(array) cardstatus string compileresults string romversion - version of the rom code. This value is stored in the rom and read by the os at compile time. Osversion - current version of the operating system. Ositem - ...

  • Page 231

    Appendix a. Cr5000 status table a-3 dldbytesfree - amount of free space in the cpu ram disk that is used to store program files. Processtime - time in microseconds that it took to run through processing on the last scan. Time is measured from the end of the endscan instruction (after the measurement...

  • Page 232

    Appendix a. Cr5000 status table a-4 commactive - a variable signaling whether or not communications is currently active (increments each time the autobaud detect code is executed). Progerrors - the number of compile (or runtime) errors for the current pro- gram. Errorcalib - a counter that is increm...

  • Page 233: Index

    Index-1 index a abs 8-1 acos 6-13, 8-2 alias 4-2, 4-4, 4-9, 5-1, 6-14, 8-23, 8-24, 9-1 am25t ov2, 1-10, 7-29 and 7-28, 8-2 asin 8-3 atn 8-4, 8-7, 8-21, 8-24, 8-30, 8-32, 8-33 atn2 8-4, 8-5 average 4-6, 6-11 avgrun 8-6, 8-7 avgspa 8-5, 8-6 b battery ov-1, ov-3, ov-9, 1-1, 1-2, 1-3, 1-4, 1-5, 1-6, 1-1...

  • Page 234

    Index index-2 i if ... Then ... Else statement 9-9, 9-10, 9-11 imp 8-13 int, fix 8-14 int8 interval timer 7-39, 7-40, 7-41 l levelcrossing 6-19, 6-22 log 8-9, 8-15, 8-16, 8-33 m maximum 2-11, 4-1, 4-2, 6-3, 6-12, 6-23 maxspa 8-16, 8-17 memorytest 8-11 minimum 2-11, 4-1, 4-2, 6-3, 6-14, 6-19, 6-23, 6...

  • Page 235

    Index index-3 timerio ov-2, 7-27 totalize 6-27, 9-1 u units 2-10, 2-11, 4-4, 4-5, 4-6, 5-3, 6-2, 6-3, 6-4, 6-5, 6-7, 6-12, 6-13, 7-5, 7-15, 7-22, 7-26, 7-27, 7-28, 7-30, 7-36, 7-42, 9-4, 9-11, 9-13, 9-14, 9-19 v voltdiff ov-2, 7-3, 8-7, 8-8, 8-30, 8-32, 9-17 voltse ov-2, 4-10, 7-3, 9-17 w while…wend...

  • Page 236

    Index index-4 this is a blank page..

  • Page 237

    This is a blank page..

  • Page 238

    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 cleroux@csafrica.Co.Za campbell scient...