57
FLG MY_FLG=1
‘declare flag MY_FLG, set to 1
This example shows a global flag being declared. To view the state of
this flag, and any other user-defined flags enter:
PRINT UFLGS
The response from the terminal would be:
MY_FLG = G TRUE
The “G” would indicate that it is a global flag at a logic TRUE state.
If this were a local flag, the “G” would be replaced with an “L”.
V A R
[ D e f i n e U s e r V a r i a b l e ]
This instruction allows the user to declare a variable and set it to some value.
The naming conventions for a user-defined variables are the same as for user-
defined flags declared with the FLG instruction. These variables can be either
global (declared in immediate mode) or local (declared within a program). Local
variables are erased and re-declared when a program executed.
The following example is a short program that will declare a local variable
named “LENGTH”, request an input from the user, then perform a relative
index the distance specified. It will then loop back to the beginning and request
input until the escape key is pressed.
PGM 200
'start program at address 200
LBL VAR_TEST
'name the program VAR_TEST
VAR LENGTH=0
'declare local variable LENGTH, set to 0
PRINT "How far do I go?";
INPUT LENGTH
'request input length in munits
MOVR LENGTH
'index relative distanc defined by LENGTH
HOLD 2
'suspend program until motion completes
PRINT "Went this far:", LENGTH
BR 200
'loop to beginning of program
END
PGM
I N P U T
[ U s e r I n p u t R e q u e s t ]
This instruction allows for data to be entered into a variable from an external
device such as a terminal or an HMI through the serial port(s).
See VAR example above for usage example.
D E L A Y
[ D e l a y P r o g r a m E x e c u t i o n ]
Delays program execution for a specified number of milliseconds.
For Example:
DELAY 1000
‘delay program execution for 1 second.
H O L D
[ H o l d P r o g r a m E x e c u t i o n ]
The HOLD instruction differs from DELAY in that it suspends program
execution until a specified motion, velocity change, or position change com-
pletes. Typically, a “HOLD 2” will be issued following a MOVA or MOVR.
This instructs the MicroLYNX to suspend the program until the previously
instructed motion is complete.
Global Flags and Variables are
declared outside of a program!
Local Flags and Variables are
declared within a program and
erased and re-declared with
program execution!
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from