beautypg.com

1 inserting comments into program, 4 programming crbasic's "basics – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 131

background image

Section 4. CRBasic – Native Language Programming

4.1.3.1 Inserting Comments into Program

Comments are non-functioning text placed within the body of a program to
document or clarify program algorithms.

As shown in Example 4.1.3-1, comments are inserted into a program by
preceding the comment with a single quote ('). Comments can be entered either
as independent lines or following CR9000X code. When the CR9000X
compiler sees the single quote it ignores the rest of the line.

EXAMPLE 4.1.3-1. CRBASIC Code: Inserting Comments

'Declaration of variables starts here.

Public Start(6)

'Declare the start time array

See Software manual or CRBasic on line help for more information.

4.1.4 Programming CRBASIC's "Basics":

There are multiple steps that need to be complete before a program is started.

1) Know your APPLICATION. Decide what parameters need to be

measured. Examples include temperature, pressure, strain, displacement,
and the list goes on. Document how many points or sensors, for each
parameter to be monitored, will be required.

EXAMPLE: Need 3 temperatures, two pressures

2) Know your SENSOR. Select the sensors that will meet the needs of step 1.

What is the output for each sensor type (Pulse, Differential Analog
Voltage, Single Ended Analog Voltage, Ratio-metric Analog Voltage
output requiring excitation ...). Once the sensor output is determined,
additional clarifiers are usually needed. Examples include:

Analog: What is the Full Scale output (sensor max voltage output)

What are the Excitation requirements

Pulse:

TTL output? (0-5 volt square wave signal)

Low level AC (zero crossing)?

It should be noted that to get the full scale voltage output of a ratio-metric
output (mV/V) sensor, you must multiple the rated mV/V by the excitation
voltage. In the example below, Pressure transducer #1 has a full scale
output of 2 mV/V. With an excitation voltage of 5 VDC, this results in a
full scale output voltage of 10 mV.

EXAMPLE Con't:
Temperature:

Type K thermocouples

Highest T: 1500 F; voltage output < 34 mV

Pressure:

Excite both with 5 Volts DC

Transducer #1

Full Scale Output: 2 mV/V @ 100 psi

Transducer #2

Full Scale Output: 3 mV/V @ 600 psi

3) Know your DESIRED DATA FORMAT. Assign names or descriptors to

each of the sensors. Decide what engineering units you want to store the
data in, and determine the required scalars to apply to the raw sensor
output. Determine the fastest measurement rate required for the collection
of sensors (may need to store temperature data at one rate and vibration

4-3