beautypg.com

Campbell Scientific AVW200-series Vibrating Wire Interfaces User Manual

Page 57

background image

AVW200-series 2-Channel Vibrating Wire Spectrum Analyzer Modules

' Example Program running in the PipeLine mode

' The clock and reset lines of both muxes are connected to the clk and rst ‘lines of the AVW200.

PipeLineMode

Public PTemp, batt_volt

Public Result, AVWDst(32,6)

Const Chan1 = 1

' AVW200 channel 1

Const Chan2 = 2

' AVW200 channel 2

Const MuxChan = 1

' Starting Mux Channel

Const Reps = 16

' Number of Reps

Const BFreq = 450

' Begin Frequency

Const EFreq = 6000

' End Frequency

Const Xvolt = 2

' 12p-p Volt Excite

BeginProg

SerialOpen (Com1,38400,0,0,0)

Scan (64,Sec,0,0)

' (2 * 32 measurement) = 64 seconds

PanelTemp (PTemp,250)

Battery (Batt_volt)

AVW200(Result,Com1,200,200,AVWDst(1,1),Chan1,MuxChan,Reps,Bfreq,Efreq,Xvolt,_60Hz,1,0)

AVW200(Result,Com1,200,200,AVWDst(17,1),Chan2,MuxChan,Reps,Bfreq,Efreq,Xvolt,_60Hz,1,0)

NextScan

EndProg

7.4 AVW200( ) Instruction Running in the Sequential Mode

Examples 7.4.1 and 7.4.2 run the AVW200 with a CR1000 using multiple

AVW200( ) instructions in a sequential mode of operation. In these example

programs, the first AVW200( ) instruction communicates with the attached

AVW200 interface module using Com1 and PakBus address 200, and tells the

AVW200 to make sixteen measurements. The CR1000 will wait at the

AVW200( ) instruction until the 16 measurements are returned from first

instruction, or until the instruction times out (time out is two times the number

of reps). If an instruction times out, it will try up to three more times before

advancing to the next instruction. The next AVW200 instruction on channel 2

is then executed and repeats the process.

Each AVW200() instruction in the examples uses a different result code

variable. In sequential mode, it is a good idea to have different result code

variables for each AVW200( ) instruction.

(1) When running in the sequential mode, programs that contain

multiple AVW200 instructions using the same COM port should

have different “Result” variables for each AVW200 instruction

(e.g. “Result1” and “Result2”) in order to detect and isolate any

communications errors for a given AVW200.

(2) If the AVW200( ) instruction is in a slowsequence, the mode

of operation is always forced to sequential mode.

NOTES

49