![background image](http://html1.mh-extra.com/html/amx/softkey-tx-sk/softkey-tx-sk_instruction-manual_2939359020.webp)
Programming
16
TX-SK+ SoftKey Transmitter
AXCESS Keywords (Cont.)
IF
The IF statement provides conditional branching of program flow.
Every IF statement must be followed by an expression enclosed in
parentheses. This provides the beginning of a conditional execution of
statements. For example:
IF (expression)
(* Statement 1 *)
If the expression is true, Axcess executes Statement 1 and then contin-
ues with whatever statements follow. If the expression is false, Statement
1 is ignored. If Statement 1 is a compound statement, it must be
enclosed in braces.
ITOA
ITOA stands for "integer to ASCII". It creates a string that represents the
decimal value of a number.
Example:
DEFINE_CONSTANT
CONST = 456
DEFINE_VARIABLE
STR[5]
VAR
DEFINE_PROGRAM
VAR = 789
STR = ITOA(123) (* STR = '123' *)
STR = ITOA(CONST) (* STR = '456' *)
STR = ITOA(VAR) (* STR = '789' *)
The comment after each statement shows the value of the array STR
after each assignment. The length value of STR is set to 3 in each case.
ITOHEX
ITOHEX stands for "integer to hexadecimal". It works in the same man-
ner as ITOA, except that the integer is transformed into a hexadecimal
ASCII string.
If you substitute the ITOA keywords in the previous example with ITO-
HEX keywords, this would be the result:
STR = ITOHEX(123) (* STR = '7B' *)
STR = ITOHEX(CONST) (* STR = '1C8' *)
STR = ITOHEX(VAR) (* STR = '315' *)
Notice there are no dollar signs ($) in the results. This is because the dol-
lar sign indicates a numerical value expressed in hexadecimal, and is
only used when telling Axcess that a number is hexadecimal.
LEFT_STRING
LEFT_STRING returns a string containing the number of characters
specified starting at the beginning of the string.
For this keyword, you must specify two parameters: the string or array
you are referencing and the number of characters you need.
Example:
STR = LEFT_STRING (PRESETS,3)
After execution of this line, the array STR will contain the first 3 charac-
ters of the array PRESETS. If PRESETS contains the string 'HELLO',
then STR will contain 'HEL.' Also, the length value of STR will be set to 3.
MID_STRING
This keyword returns the specified amount of characters starting at a
specified location in the source string. Three parameters, rather than
two, are needed for its operation: the string to reference, the position at
which to start, and the number of characters to return.
Example:
STR = MID_STRING (PRESETS,2,3)
This line tells Axcess: "Place three characters from the array PRESETS,
starting at location 2 and moving to the right, into the array variable
STR." If PRESETS contains 'HELLO', this line will assign 'ELL' to the
array STR. This keyword also will set the length value of the array receiv-
ing the result.