B.2 control port example program, Appendix b.2, control port example program – Campbell Scientific 014A Met One Wind Speed Sensor User Manual

Page 27

Advertising
background image

Appendix B. Example Programs

B.2 Control Port Example Program

The following CR5000 program uses control ports to measure three 014A wind

speed sensor. The program measures them every second and stores the mean

wind speed (in m s

–1

) every 15 seconds.

'CR5000 Series Datalogger
'Wind Speed using TimerIO Instruction

'Declare Variables and Units
Public J, WindSpeed(3)

'Define Data Tables
DataTable(Test,1,-1)
DataInterval(0,15,Sec,10)
Average(3,WindSpeed(),IEEE4,False)
EndTable

'Define Subroutines
'Sub
'Enter Sub instructions here
'EndSub

'Main Program
BeginProg
Scan (1,Sec,0,0)
'Measure the WindSpeed Profile 014A, 3 anemometers connected to C4, C5, C6 ports

TimerIO (WindSpeed(1),11000111,00222000,100,0) 'Frequency on falling edge
'Convert measurement to m/s
For j = 1 to 3
WindSpeed(j) = 0.447 + WindSpeed(j)/1.25
Next j
CallTable Test
Next Scan
End Prog

B-3

Advertising