beautypg.com

Programming, 1 cr1000 crbasic program example – Campbell Scientific CS410 Shaft Encoder User Manual

Page 6

background image

CS410 Shaft Encoder

5. Programming

The shaft encoder is measured with the PulseCount instruction in CRBasic and
Instruction 3 in Edlog.

Dataloggers that use CRBasic are the CR200-series, CR800, CR850, CR1000,
and CR3000. Our older dataloggers use Edlog.

Multiplier for the PulseCount instruction or Instruction 3:

The multiplier is based on the wheel circumference and the shaft encoder
counts per revolution:

MULTIPLIER = WHEEL CIRCUM. (in desired units)/ (COUNTS/REV.)

The CS410 has 100 counts/revolution, thus with a 1-foot circumference wheel:

MULTIPLIER = 1/100 = .01 (measures in feet)

5.1 CR1000 CRBasic Program Example

This program collects and processes data. Output is set to report the stage
level and offset at 15-minute intervals, but is easily changed if desired. Offsets
to the Stage level are automatically calculated when an observed gage height is
entered into the variable named "enter_obs_gage_ht". The offset and other
variables are preserved in the datalogger even if power is lost to the unit.
However, any changes to the stage are NOT recorded during power outages.

'CR1000 Series Datalogger
'CS410-L Shaft Encoder

'Declare Public Variables
PreserveVariables

'values will be retained even if power is lost


Public enter_obs_gage_ht

'variable where you enter observed gage height

Public old_gage_ht

'also holding previous value for comparison

Public batt_volt
Public Stage_lvl, offset,Count(2)
Alias Count(1) = Up
Alias Count(2) = Down
Units Stage_lvl = feet

'modify only if changing Pulley_Circ value, below


'Declare Other Variables
Dim FtPerCount

'Declare Constants
Const Pulley_circ = 1

'foot (edit if units other than feet are desired for

'the Stage_lvl record, or if using a pulley with different circumference)

Const PulsesPerRev = 100

'CS410 encoder resolves 100 counts per revolution

2