![background image](http://html1.mh-extra.com/html/omron/trajexia-cj1w-mch72/trajexia-cj1w-mch72_operation-manual_742454232.webp)
All BASIC commands
Section 4-2
221
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
.
Содержание trajexia CJ1W-MCH72
Страница 69: ...Specifications Section 2 4 58...
Страница 83: ...FINS commands Section 3 4 72...
Страница 147: ...All BASIC commands Section 4 2 136 AXIS 1 AXIS 0...
Страница 277: ...All BASIC commands Section 4 2 266...
Страница 278: ...267 SECTION 5 Examples This chapter gives 2 categories of examples and tips How to s Practical examples...
Страница 371: ...360 Index...
Страница 373: ...362...