English
Language : 

CJ1W-MCH72 Datasheet, PDF (205/374 Pages) Omron Electronics LLC – Programmable Controller SYSMAC CJ-series CJ1W-MCH72
All BASIC commands
Section 4-2
/i
Example
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 posi-
tion 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
An X-Y plotter has a pen carousel. The position of this carousel is fixed
relative 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
AXIS 1
0,0
AXIS 0
194