![Sollae Systems PES-2403 Скачать руководство пользователя страница 22](http://html1.mh-extra.com/html/sollae-systems/pes-2403/pes-2403_user-manual_1316208022.webp)
PES-2403 User Manual > How to use > Settings the Initial Position > Stop automatically
2017-07-28
Sollae Systems
page 22 of 26
Stop automatically
A command goto ~ sw can be used to automatically stop the stepper motor operation when the
limit switch is closed.
If the motor stops by this command, the status value of the motor becomes the stopped status.
a format of the goto ~ sw command
"goto [dir]sw(id) [speed] [accel] [decel]"
※ Caution: there is no space between [dir] and sw(id)
argument
description
mandatory/optional
dir
direction, "+"(forward) or "-"(reverse)
optional(default: "+")
id
ID of a digital input port, 0/1/2/3
mandatory
speed
speed(unit: pps)
optional
accel
acceleration(unit: pps/s)
optional
decel
deceleration(unit: pps/s)
optional
an example of stopping a motor automatically
<?php
include_once "/lib/sd_spc.php";
spc_reset();
spc_sync_baud(460800);
$sid = 1;
spc_request_dev($sid, "set vref stop 2");
spc_request_dev($sid, "set vref drive 8");
spc_request_dev($sid, "set mode full");
// rotate until digital input 0 is LOW
echo "find positive limit ...";
spc_request_dev($sid, "goto +sw0 400 0");
while((int)spc_request_dev($sid, "get state"))
usleep(1);
echo "done\r\n";
sleep(1);
// rotate until digital input 1 is LOW
echo "find negative limit ...";
spc_request_dev($sid, "goto -sw1 400 0");
while((int)spc_request_dev($sid, "get state"))
usleep(1);
echo "done\r\n";