Galil Motion Control DMC-21 5 Series User Manual page 76

Table of Contents

Advertisement

Example: Error Correction
The following code demonstrates what is necessary to set up SPM mode for the A axis, detect error, stop the
motor, correct the error, and return to the main code. The drive is a full step drive, with a 1.8
4000 count/rev encoder. When error occurs, the axis will stop due to OE1. In #POSERR, query the status
the error QS, correct, and return to the main code.
#setup
OE
1;
KS
16;
MT -2,-2,-2,-2;
YA
2;
YB
200;
YC
4000;
SH
A;
WT
100;
#motion;
SP
512;
PR
1000;
BG
A;
EN;
#POSERR;
ST
A;
AM
A;
WT
100;
spsave=_SPA;
JP
#return,(_YSA<>2);
SP
64;
MG
"ERROR=
",_QSA
YRA=_QSA;
MC
A;
MG
"CORRECTED, ERROR NOW=
WT
100;
#return
SPA=spsave;
RE
0;
Chapter 6 Programming Motion ▫ 71
'set the profiler to stop axis upon error
'set step smoothing
'motor type set to stepper
'step resolution of the drive
'motor resolution (full steps per revolution)
'encoder resolution (counts per revolution)
'enable axis
'allow slight settle time
'perform motion
'set the speed
'prepare mode of motion
'begin motion
'end of program subroutine
'automatic subroutine is called when _YS=2
'stop and wait for motion to finish
'wait helps user see the correction
'save current speed setting
'return to thread zero if invalid error
'set slow speed setting for correction
'use QS for correction
'wait for motion to complete
",_QSA
'wait helps user see the correction
'return the speed to previous setting
'return from #POSERR
o
step motor and
and
YS
DMC-21x5 User Manual 1.0a1

Advertisement

Table of Contents
loading

Table of Contents