AKD BASIC User Guide | 3 AKDBASICLanguage
3.5.29 Swap
Swap x, y
Swaps the values of the variables. The variable types must be the same. Does not work on
arrays or strings.
3.5.30 When
When when-condition , when-action
When is used for very fast output response to certain input conditions. You specify the con-
dition and action. Upon encountering When, program execution waits until the defined condition
is satisfied. The program immediately executes the action and continues with the next line of
the program.
The When statement provides latching of several variables when the When condition is sat-
isfied. These variables are:
WHEN.DRVHANDWHEEL WHEN.FB1MECHPOS
WHEN.PLCMD WHEN.DRVTIME
WHEN.PLFB
The software checks for the defined condition at the 4Khz rate. The when action is queued up
and executed immediately. The when action will be executed within 25 microseconds of the
when condition being met.
3.5.31 While…Wend
While condition
...statement block...
Wend
While...Wend tells the program to execute a series of statements as long as an expression
after the While statement is true.
If the expression is true, the loop statements between While and Wend are executed. The
expression is evaluated again and if the expression is still true, the loop statements are
executed again. This continues until the expression is no longer true. If the expression is not
true, the statement immediately following the Wend statement is executed.
3.6 Built-in Functions
A function that takes a numeric argument (either FLOAT or INTEGER) returns the same type.
Coercion between INTEGER and FLOAT is not performed unless necessary. (notation - the
arguments n and m refer to INTEGER types, as in the definition of the MID$ function, whose
signature is MID$(string, integer, integer).
Name Args Return Semantics
ABS numeric numeric absolute value
ATAN float float arc tangent (radians)
CINT numeric int truncate (round to nearest int)
COS float float cosine
35 Kollmorgenâ„¢ | March 30, 2012