Event Trigger - Multiple Move with Wait
This example makes multiple relative distance moves by waiting for each to be complete before executing new
moves.
#MOVES;'
Label
PR 12000;'
Distance
SP 20000;'
Speed
AC 100000;'
Acceleration
BGX;'
Start Motion
AD 10000;'
Wait a distance of 10,000 counts
SP 5000;'
New Speed
AMX;'
Wait until motion is completed
WT 200;'
Wait 200 ms
PR -10000;'
New Position
SP 30000;'
New Speed
AC 150000;'
New Acceleration
BGX;'
Start Motion
EN;'
End
Define Output Waveform Using AT
The following program causes Output 1 to be high for 10 msec and low for 40 msec. The cycle repeats every 50
msec.
#OUTPUT;'
Program label
AT0;'
Initialize time reference
SB1;'
Set Output 1
#LOOP;'
Loop
AT 10;'
After 10 msec from reference,
CB1;'
Clear Output 1
AT -40;'
Wait 40 msec from reference and reset reference
SB1;'
Set Output 1
JP #LOOP;'
Loop
EN;'
End Program
Using AT/WT with non-default TM rates
By default both WT and AT are defined to hold up program execution for 'n' number of milliseconds (WT n or AT n).
The second field of both AT and WT can be used to have the program execution be held-up for 'n' number of
samples rather than milliseconds. For example WT 400 or WT 400,0 will hold up program execution for 400 msec
regardless of what is set for TM. By contrast WT 400,1 will hold up program execution for 400 samples. For the
default TM of 1000 the servo update rate is 976us per sample, so the difference between WT n,0 and WT n,1 is
minimal. The difference comes when the servo update rate is changed. With a low servo update rate, it is often
useful to be able to time loops based upon samples rather than msec, and this is where the “unscaled” WT and AT
are useful. For example:
#MAIN;'
Label
TM 250;'
250us update rate
#MOVE;'
Label
PRX=1000;'
Position Relative Move
BGX;'
Begin Motion
MCX;'
Wait for motion to complete
WT 2,1;'
Wait 2 samples (500us)
SB1;'
Set bit 1
EN;'
End Program
In the above example, without using an unscaled WT, the output would either need to be set directly after the
motion was complete, or 2 ms after the motion was complete. By using WT n,1 and a lower TM, greater delay
resolution was achieved.
Chapter 7 Application Programming ▫ 109
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...