BASIC commands
PROGRAMMING MANUAL
136
R
e
vi
si
o
n
1
.0
fig. 35
/i
Example
A machine must move to one of 3 positions depending on the selection made
by 2 switches. The options are home (if both switches are off), position 1 (if
the first switch is on and the second switch is off) and position 2 (if the first
switch is off and the second switch is on). Position 2 has priority over position
1.
'define absolute positions
home=1000
position_1=2000
position_2=3000
WHILE IN(run_switch)=ON
IF IN(6)=ON THEN 'switch 6 selects position 2
MOVEABS(position_2)
WAIT IDLE
ELSEIF IN(7)=ON THEN 'switch 7 selects position 1
MOVEABS(position_1)
WAIT IDLE
ELSE
MOVEABS(home)
WAIT IDLE
ENDIF
WEND
Example
An X-Y plotter has a pen carousel. The position of this carousel is fixed rela-
tive to the absolute zero position of the plotter. To change pens, an absolute
move to the carousel position finds the target irrespective of the plot position.
MOVEABS(28.5,350) ' move to just outside the pen holder area
WAIT IDLE
SPEED = pen_pickup_speed
MOVEABS(20.5,350) ' move in to pick up the pen