Example: Error Correction
The following code demonstrates what is necessary to set up SPM mode for the X 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
o
step motor and 4000
count/rev encoder.
#SETUP
OE1;
Set the profiler to stop axis upon error
KS16;
Set step smoothing
MT-2,-2,-2,-2;
Motor type set to stepper
YA2;
Step resolution of the drive
YB200;
Motor resolution (full steps per revolution)
YC4000;
Encoder resolution (counts per revolution)
SHX;
Enable axis
WT100;
Allow slight settle time
#MOTION
Perform motion
SP512;
Set the speed
PR1000;
Prepare mode of motion
BGX;
Begin motion
#LOOP;JP#LOOP;
Keep thread zero alive for #POSERR to run in
REM When error occurs, the axis will stop due to OE1. In
REM #POSERR, query the status YS and the error QS, correct,
REM and return to the main code.
#POSERR;
Automatic subroutine is called when YS=2
WT100;
Wait helps user see the correction
spsave=_SPX;
Save current speed setting
JP#RETURN,_YSX<>2;
Return to thread zero if invalid error
SP64;
Set slow speed setting for correction
MG
"
ERROR=
"
,_QSX
YRX=_QSX;
Else, error is valid, use QS for correction
MCX;
Wait for motion to complete
MG
"
CORRECTED, ERROR NOW=
"
,_QSX
WT100;
Wait helps user see the correction
#RETURN
SPX=spsave;
Return the speed to previous setting
REO;
Return from #POSERR
Example: Friction Correction
The following example illustrates how the SPM mode can be useful in correcting for X axis friction after each move
when conducting a reciprocating motion. The drive is a 1/64th microstepping drive with a 1.8
o
step motor and 4000
count/rev encoder.
#SETUP;
Set the profiler to continue upon error
KS16;
Set step smoothing
MT-2,-2,-2,-2;
Motor type set to stepper
YA64;
Step resolution of the microstepping drive
YB200;
Motor resolution (full steps per revolution)
Chapter 6 Programming Motion
•
119
DMC-40x0 User Manual
Summary of Contents for DMC-4040
Page 54: ...Chapter 3 Connecting Hardware 45 DMC 40x0 User Manual...
Page 55: ...DMC 40x0 User Manual Chapter 3 Connecting Hardware 46...
Page 56: ...Chapter 3 Connecting Hardware 47 DMC 40x0 User Manual...
Page 73: ...Figure 4 1 GalilTools DMC 40x0 User Manual Chapter 4 Software Tools and Communication 64...
Page 185: ...THIS PAGE LEFT BLANK INTENTIONALLY DMC 40x0 User Manual Chapter 7 Application Programming 176...
Page 205: ...THIS PAGE LEFT BLANK INTENTIONALLY DMC 40x0 User Manual Chapter 10 Theory of Operation 196...
Page 222: ...Step 2 Remove ICM s Appendices 213 DMC 40x0 User Manual...
Page 232: ...DMC 4080 Steps 4 and 5 Step 4 Replace ICM s Appendices 223 DMC 40x0 User Manual...