Omron TJ2-MC64 - PROGRAMMING Programming Manual page 171

Hide thumbs Also See for TJ2-MC64 - PROGRAMMING:
Table of Contents

Advertisement

BASIC commands
Example
A rotating shaft has a cam operated switch which has to be changed for differ-
ent 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 calculated and set.
Each pulse on an encoder gives four edges for the TJ2-MC64 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.
PROGRAMMING MANUAL
165

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tj1-prtTj1-drtTj1-cortTj1-mlGrt1-ml2Tj1-fl02

Table of Contents