variable_name VAR variable_type
Where variable_name is the name of the variable, VAR is the keyword for declaring a variable and variable_type being the type of the variable. See the table below for a list of variable types that can be used.
|Bit||1||1 or 0|
|Nib||4||0 to 15|
|Byte||8||0 to 255|
|SByte||8||-128 to +127|
|Word||16||0 to 65,535|
|SWord||32||-32,768 to +32,767|
|Long||32||0 to 4,294,967,295|
|SLong||32||-2,147,483,647 to +2,147,483,648|
|Float||32||± 2.0 EXP -126 to ± 2.0 EXP 127|
second VAR Word ; a 16-bit word variable declared
third VAR Float ; a 32-bit floating point variable declared
first = 1; storing a value of 1 in the variable named first
first = first + 1; the expression “first + 1”, which evaluates to 2, is stored in the variable first. The value of first is now 2.
familiar FCON 3.16
someBits VAR Bit(10) ; this declares an array of 10 bit values named someBits
To write to a location in the array an index is used along with the name of the array. The index numbering starts at zero and end with one less than the size of the array. See the box below for an example.
someBits(9) = 1 ; 1 is stored at the very end of the array
variable_name type value
Where avriable_name is the name of the variable, type if the type of data to store and value is the actual data to store in the constant table. The type can be one of the types in the table below.
|ByteTable||Each table index point is byte sized (8 bits).|
|SByteTable||Each table index point is sbyte sized(signed 8 bits).|
|WordTable||Each table index point is word sized (16 bits).|
|SWordTable||Each table index point is sword sized(signed 16 bits).|
|LongTable||Each table index point is long sized (32 bits).|
|SLongTable||Each table index point is slong sized (32 bits).|
|FloatTable||Each table index point is floating point sized (32 bits).|
hello(0) ; this evaluates to the character “H”