User Manual
MCP Series
Brushed DC Motor Controllers
MCP Series User Manual
108
3.1.11 Constants
Constants are dened values that will never change. The assigned value is stored in program
memory and can not be changed. Constants are set during compile time by MCL. Constants are
a convenient way to give a name to a numeric value. They are typically used to make a program
more human readable. There are two types of constants. Normal constants dened using CON
and an explicit oating point constant dened by FCON. You can use almost any name for a
constant, except reserved words (see manual appendix).
Example:
LimitTravel CON 255
MaxSpeed FCON 6.50
3.1.12 Constant Tables
Tables are similar to arrays except tables only store constant values. You can store large strings
of text in a constant table. Each position is accessed like arrays using an index number. Values
assigned to a table are stored in program memory and can not be changed during program run
time. A common use for constant tables is building interactive menu systems. If the user selects
n reply with a string from table n. Constant tables are restricted to word boundaries if you have
an odd number of bytes in a byte table an extra byte is added for padding automatically.
Example:
Sentence ByteTable “Hello World!”
The above example bytetable Sentence contains the string Hello World!. Each character including
the space is a byte in the table. Sentence contains 12 bytes. To access the bytes you would use
an index value of 0 to 11.
Example:
Temp VAR Byte
Sentence ByteTable “Hello World!”
Temp = Sentence(0)
The variable Temp now is equal to the ASCII value H since index 0 is the rst byte in the
dened table.
3.1.13 Table Types
Type Description
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 oating point sized (32 bits).