Omron SYSMAC CJ Operation Manual page 232

Sysmac cj-series programmable controller motion control unit
Hide thumbs Also See for SYSMAC CJ:
Table of Contents

Advertisement

All BASIC commands
220
Arguments
switch
The switch number. Range: [0,15].
enable
The switch enable. Range: [on, off].
axis
The number of the axis providing the position input.
output_number
The physical output to set. Range: [8,31].
output_state
The state to output. Range: [on, off].
set_position
The absolute position in user units at which output is set.
reset_position
The absolute position in user units at which output is reset.
Example
A rotating shaft has a cam operated switch which has to be changed for
different size work pieces. There is also a proximity switch on the shaft
to indicate the TDC of the machine. With a mechanical cam, the change
from job to job is time consuming. This can be eased by using
PSWITCH as a software cam switch. The proximity switch is wired to
input 7 and the output is output 11. The shaft is controlled by axis 0. The
motor has a 900ppr encoder. The output must be on from 80 units.
PSWITCH uses the unit conversion factor to allow the positions to be
set in convenient units. First the unit conversion factor must be calcu-
lated and set. Each pulse on an encoder gives four edges for the CJ1W-
MCH72 to count. There are thus 3,600 edges/rev or 10 edges/degree. If
you set the unit conversion factor to 10, you can work in degrees.
Next you have to determine a value for all the PSWITCH arguments.
sw: The switch number can be any switch that is not in use. In this
example, you will use number 0.
en: The switch must be enabled to work; set the enable to 1.
axis: The shaft is controlled by axis 0.
opno: The output being controlled is output 11.
opst: The output must be on so set to 1.
setpos: The output is to produced at 80 units.
rspos: The output is to be on for a period of 120 units.
This can all be put together in the following lines of BASIC code:
switch:
UNITS AXIS(0) = 10 ' Set unit conversion factor
REP_DIST = 360
REP_OPTION = ON
PSWITCH(0,ON,0,11,ON,80,200)
This program uses the repeat distance set to 360 degrees and the
repeat option on so that the axis position will be maintained between 0
and 360 degrees.
See also
HW_PSWITCH, OP, UNITS.
Section 4-2

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac cj1w-mch72

Table of Contents