Section 9. program control instructions, Beginprog, endprog – Campbell Scientific CR5000 Measurement and Control Module User Manual
Page 207

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 statements. Program Variables, DataTables, and Subroutines must be
defined before the main program. The BeginProg/EndProg statements are not
necessary if there are no subroutines or DataTables.
BeginProg Example
The following code shows the layout of a typical datalogger program and the
use of the BeginProg/EndProg statements. Program variables and the
DataTable are defined, followed by the code for the main program.
'Define Variables for WindSpeed and Rain
'Dimension the RealTime array
PUBLIC WINDSP
PUBLIC RAIN
DIM TIME(9)
ALIAS TIME(1)=YEAR
ALIAS TIME(2)=MONTH
ALIAS TIME(3)=DAY
ALIAS TIME(4)=HOUR
ALIAS TIME(5)=MINUTES
ALIAS TIME(6)=SECONDS
ALIAS TIME(7)=mSECONDS
ALIAS TIME(8)=DAY_OF_WEEK
ALIAS TIME(9)=DAY_OF_YEAR
'Define the DataTable, METDATA
DataTable (METDATA,1,1000)
DataInterval (0,1,Min,10)
Sample (1,WINDSP,FP2)
Totalize (1,RAIN,FP2,False )
EndTable
'Main program - Read datalogger real-time clock
'Measure 2 pulse count channels and Call DataTable
BeginProg