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
OE 1;'
Set the profiler to stop axis upon error
KS 16;'
Set step smoothing
MT -2,-2,-2,-2;'
Motor type set to stepper
YA 2;'
Step resolution of the drive
YB 200;'
Motor resolution (full steps per revolution)
YC 4000;'
Encoder resolution (counts per revolution)
SH A;'
Enable axis
WT 100;'
Allow slight settle time
#motion;'
Perform motion
SP 512;'
Set the speed
PR 1000;'
Prepare mode of motion
BG A;'
Begin motion
EN;'
End of program subroutine
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
WT 100;'
Wait helps user see the correction
spsave=_SPA;'
Save current speed setting
JP #return,_YSA<>2;'
Return to thread zero if invalid error
SP64;
Set slow speed setting for correction
MG "ERROR= ",_QSA
YRA=_QSA;'
Else, error is valid, use QS for correction
MC A;
Wait for motion to complete
MG "CORRECTED, ERROR NOW= ",_QSX
WT 100;'
Wait helps user see the correction
#return
SPA=spsave;'
Return the speed to previous setting
RE 0;'
Return from #POSERR
Chapter 6 Programming Motion ▫ 94
DMC-42x0 User Manual
Summary of Contents for DMC-42 0 Series
Page 195: ...ICM 2900 PCB Layout Appendices 191 DMC 42x0 User Manual...
Page 205: ...CB 50 100 Drawings Appendices 201 DMC 42x0 User Manual...
Page 206: ...Appendices 202 DMC 42x0 User Manual...
Page 207: ...Appendices 203 DMC 42x0 User Manual...
Page 208: ...Appendices 204 DMC 42x0 User Manual...
Page 209: ...Appendices 205 DMC 42x0 User Manual...
Page 210: ...Appendices 206 DMC 42x0 User Manual...
Page 211: ...Appendices 207 DMC 42x0 User Manual...
Page 214: ...CB 50 80 Drawing Appendices 210 DMC 42x0 User Manual...