04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Section 7. Installation<br />

variables can be viewed through the external keyboard / display or software<br />

numeric monitors. Dim variables cannot.<br />

All user defined variables are initialized once when the program starts.<br />

Additionally, variables that are used in the Function() or Sub() declaration,or that<br />

are declared within the body of the function or subroutine are local to that<br />

function or subroutine.<br />

Variable names can be up to 39 characters in length, but most variables should be<br />

no more than 35 characters long. This allows for four additional characters that<br />

are added as a suffix to the variable name when it is output to a data table.<br />

Variable names can contain the following characters:<br />

• A to Z<br />

• a to z<br />

• 0 to 9<br />

• _ (underscore)<br />

• $<br />

Names must start with a letter, underscore, or dollar sign. Spaces and quote<br />

marks are not allowed. Variable names are not case sensitive.<br />

Several variables can be declared on a single line, separated by commas:<br />

Public RefTemp, AirTemp2, Batt_Volt<br />

Variables can also be assigned initial values in the declaration. Following is an<br />

example of declaring a variable and assigning it an initial valued.<br />

Public SetTemp = {35}<br />

In string variables, string size defaults to 24 characters (changed from 16<br />

characters in April 2013, OS 26).<br />

Arrays<br />

When a variable is declared, several variables of the same root name can also be<br />

declared. This is done by placing a suffix of "(x)" on the alphanumeric name,<br />

which creates an array of x number of variables that differ only by the<br />

incrementing number in the suffix. For example, rather than declaring four similar<br />

variables as follows,<br />

Public TempC1<br />

Public TempC2<br />

Public TempC3<br />

Public TempC4<br />

simply declare a variable array as shown below:<br />

Public TempC(4),<br />

This creates in memory the four variables TempC(1), TempC(2), TempC(3), and<br />

TempC(4).<br />

A variable array is useful in program operations that affect many variables in the<br />

same way. CRBasic example Using a variable array in calculations (p. 117) shows<br />

program code using a variable array to reduce the amount of code required to<br />

convert four temperatures from Celsius degrees to Fahrenheit degrees.<br />

116

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!