beautypg.com

Calltable, Default program – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 332

background image

Section 9. Program Control Instructions

value of the variable that was passed in. If a constant is
passed to one of the subroutine declared “variables”, that
“variable” becomes a constant and its value cannot be
changed by the subroutine.

You are never required to use the Call keyword when calling a subroutine. If
you use the Call keyword to call a procedure that requires arguments, the
arguments list must be enclosed in parentheses.

You can pass arguments to a procedure by reference (variable) or by value
(constant or numeric value). Values of arguments passed by reference can be
altered by the procedure when the arguments are returned.

See the Sub topic in Section 5 Program Declarations for Example and
additional information on Subroutines.

CallTable

Used to call a data table.

Syntax

CallTable

Name

Remarks

Calls a DataTable that has been declared prior to the BeginProg statement.

When the DataTable is called, it will process data as programmed and check

the output condition.

CallTable Example

This example uses CallTable to Call the ACCEL data table.

Default Program

A program called Default.C9X can be stored on the CR9000X CPU drive. At
power up, the CR9000X looks for and, when it exists, loads Default.C9X if no
other program takes priority

See "Program File run hierarchy" in the "Powerup.ini" topic in Section 9.2,
Datalogger Status/Control
.

'This example uses the

FileMark

command.

Public TBlk1(1) : Units TBlk1 = Deg_F

Dim TRef(1)

'Declare Reference Temp variable

Public Flag(8), Count

DataTable(TEMP,True,-1)

'Trigger, auto size


CardOut (0 ,1000)

'Write data to PC Card

DataInterval(0,0,0,50)

'Synchronous, 50 lapses, autosize

Average (1,TBlk1(),FP2,False)

'1 Reps,Source,Res

EndTable

'End of table TEMP

BeginProg

'Program begins here

Scan

0,0)

'Scan once every 10mSecs, non-burst

(500,1,

ModuleTemp(TRef(),1,5,20)

'RefTemp,CardCount,StartCard,Integrate

TCDiff(TBlk1(),1,mV50,5,1,TYPET,TRef(1),True,30,40,1.8,32)

CALLTABLE

TEMP

'Go up and run Table TEMP

Next Scan

'Loop up for the next scan

EndProg

'Program ends here

9-2