BASIC commands
PROGRAMMING MANUAL
127
Revi
si
on 3.0
3.2.215 RAPIDSTOP
/i
3.2.216 READ_BIT
/i
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 TJ1-MC__ 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
REPDIST = 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
.
Type
Axis command
Syntax
RAPIDSTOP
RS
Description
The
RAPIDSTOP
command cancels the current move on all axes from the
current move buffer (
MTYPE
). Moves for speed profiled move commands
(
MOVE
,
MOVEABS
,
MOVEMODIFY
,
FORWARD
,
REVERSE
,
MOVECIRC
and
MHELICAL
) will decelerate to a stop with the deceleration rate as set by
the
DECEL
parameter. Moves for other commands will be immediately
stopped.
Notes:
•
RAPIDSTOP
cancels only the presently executing moves. If further
moves are buffered in the next move buffers (
NTYPE
) or the task buffers
they will then be loaded.
•
During the deceleration of the current moves additional
RAPIDSTOP
s
will be ignored.
Arguments
N/A
Example
No example.
See also
CANCEL
,
MTYPE
,
NTYPE
.
Type
System command
Syntax
READ_BIT(bit_number, vr_number)
Description
The
READ_BIT
command returns the value of the specified bit in the speci-
fied VR variable, either 0 or 1.
Arguments
•
bit_number
The number of the bit to be read. Range: [0,23].
•
vr_number
The number of the VR variable for which the bit is read. Range: [0,1023].
Example
No example.
See also
CLEAR_BIT
,
SET_BIT
.
I52E-EN-03.book Seite 127 Freitag, 29. Juni 2007 11:55 11