6 program statements, Program statements – High Country Tek emc-3L User Manual
Page 53
4.6 Program Statements
The programming tool supports the following basic-like statements:
Refer to Appendix B for examples of how to use program statements and logical operators.
Programming statements including keywords are all non case sensitive.
Code Comments
Dim VarName as Uint
Declares a 0 to 65,535 value variable
All variables are Global
Dim VarName as Timer
Declares a Uint variable that once set will decrement at 10ms
intervals until it reaches zero.
Dim VarName as EEmem
Create a Uint location in memory that can be stored in
permanent non-volatile memory. Up to 128 EEmem resident
variables can be declared.
Private VarName as Uint/Timer/String
Private variables are only referenceable within the logic
sequence in which they are defined. Code reuse is the
primary reason for using Private variables.
Const VarName = Value
Declares a constant named VarName
If (Logic Statement) Then
If Statement Logical Operators are AND, OR, XOR, NOT, <,
>, =, <>, !=, >=, and <=
ElseIf (Logic Statement) Then
The else if condition
Else
The else condition
End If
The end of an If Statement
Var = Algebraic Statement
Algebra Statements can include +, -, *, and /
On and True are equivalent to the value 65535
Off and False are equivalent to the value 0
' Comment
Comments are started by using a " ' "
0xFFFF
Hex Notation
Some statements unique to the Bubble Language are:
Code Comments
A = 100%
The % after a number will scale the value between 0 and 1023.
Percentage numbers can include a decimal e.g. PWM_1 = 75.3%
TimerA = 100ms
The ms after a number scales the value to units of 10ms. i.e.
Timer0 = 250ms
TimerA = 1s
The s after a number scales the value to units of 10 milliseconds.
s numbers can include a decimal e.g. Timer1 = 5.8s
Supply > 20sv
The sv after a number will scale the value to units of supply
voltage. Supply is the voltage powering the unit. sv numbers
can include a decimal, e.g. Var = 13.8sv
P/N: 021-00163, Rev. A.0 - for V5.2 Tools
Page | 53