Section 9. Programming
74
Variable names can be up to 16 characters in length, but most variables should
be no more than 12 characters long. This allows for the 4 additional characters
that are added as a suffix to the variable name when it is output to a data table.
Variable names cannot start with a number or contain spaces or quote marks (“),
but can contain numbers and underscores (_). Several variables can be declared
on a single line, separated by commas:
Public RefTemp, AirTemp2, Batt_Volt
9.6.1.1
Arrays
When a variable is declared, several variables of the same root name can also be
declared. This is done by placing a suffix of "(x)" on the alphanumeric name,
which creates an array of x number of variables that differ only by the
incrementing number in the suffix. For example, rather than declaring four
similar variables as follows,
Public TempC1
Public TempC2
Public TempC3
Public TempC4
simply declare a variable array as shown below:
Public TempC(4),
This creates in memory the four variables TempC(1), TempC(2), TempC(3),
and TempC(4).
A variable array is useful in program operations that affect many variables in the
same way.
CRBASIC EXAMPLE. Using a Variable Array in Calculations
(p.
74) shows program code using a variable array to reduce the amount of code
required to convert four temperatures from Celsius degrees to Fahrenheit
degrees.
In this example a For/Next structure with a changing variable is used to specify
which elements of the array will have the logical operation applied to them. The
CRBASIC For/Next function will only operate on array elements that are clearly
specified and ignore the rest. If an array element is not specifically referenced,
e.g., TempC(), CRBASIC references only the first element of the array,
TempC(1).
Summary of Contents for CR200
Page 32: ...Section 2 Quickstart Tutorial 22 ...
Page 45: ...Section 3 Overview 35 3 3 Specifications ...
Page 46: ...Section 3 Overview 36 ...
Page 58: ...Section 4 Sensor Support 48 ...
Page 62: ...Section 5 Measurement and Control Peripherals 52 ...
Page 78: ...Section 8 CR200 X Configuration 68 ...
Page 102: ...Section 9 Programming 92 ...
Page 138: ...Section 11 Programming Resource Library 128 ...
Page 156: ...Section 16 Support Software 146 ...
Page 160: ...Section 17 Care and Maintenance 150 ...
Page 167: ...Section 18 Troubleshooting 157 18 3 3 2 Charging Circuit Test Solar Panel ...
Page 168: ...Section 18 Troubleshooting 158 18 3 3 3 Charging Circuit Test Transformer ...
Page 169: ...Section 18 Troubleshooting 159 18 3 3 4 Adjusting Charging Circuit Voltage ...
Page 170: ...Section 18 Troubleshooting 160 ...
Page 184: ...Appendix A Glossary 14 ...
Page 190: ...Appendix B Status Table and Settings 20 ...
Page 192: ...Appendix C Serial Port Pin Outs 22 ...
Page 211: ......