DMC Commands Flashcards
TP
Tell Position
The TP command returns the current position of the motor.
TP: ' Return all motor positions 200, -10, 50, 400 //controller response TPA ; ' Return the A motor position 200 //controller response TPB ; ' Return the B motor position -10 //controller response position =_TPA ; ' assign current position of A to a variable
DP
Define Position
The DP command sets the current motor position and current command positions to a user specified value. The units are in quadrature counts. This command will set both the TP and RP values.
DP 0,-1000;' Set position of A to zero and B to -1000 TP?,? ; ' Interogate controller for current positions 0,-1000 //controller response
TE
Tell Error
The TE command returns the position error of the motor(s), which is the difference between commanded (RP) and actual (TP) position.
TE ; ' Return all position errors 5, -2, 0, 6 //controller response TEB ; ' Return position error of B -2 //controller response
RP
Reference Position
The RP command returns the commanded reference position of the motor(s).
The relationship between RP, TP and TE: TE equals the difference between the reference position, RP, and the actual position, TP.
TE = RP - TP
RP command is useful when operating step motors since it provides the commanded position in steps when operating in stepper mode.
_RPm contains the commanded reference position for the specified axis.
RP;' Return A,B,C,D reference positions 200,-10,0,-110 //controller response RPA ; 'Return the A motor reference position 200 //controller response RPB ; 'Return the B motor reference position -10 //controller response
SH
Servo Here (Enable Motor)
The SH commands tells the controller to use the current motor position as the command position (ie: zeros the position error) and to enable servo control at the current position, thus providing torque to the motor. Toggles the amplifier enable signal when using external drives.
SH;' Enable/servo A,B,C,D motors SHA;' Only servo the A motor, the B,C and D motors remain in its previous state. SHB;' Servo the B motor, leave the A,C and D motors unchanged SHC;' Servo the C motor, leave the A,B and D motors unchanged SHD;' Servo the D motor, leave the A,B and C motors unchanged
MO
Motor Off (Disable Motor)
The MO command turns off the motor command line and toggles the amplifier enable signal.
MO; 'Turns off all motors MO A; 'Turns off the A motor. MO B; 'Turns off the B motor. MO CA; 'Turns off the C and A motors. SH; 'Turns all motors on axis1= _MOA; 'Sets variable equal to the A-axis servo status
PR
Position Relative
The PR command sets the incremental distance and direction of the next move. The move is referenced with respect to the current position. Units are counts.
PR 100,200; ' Set relative distance targets BG; ' Begin moves MAB: ' Wait for motion on A and B to complete PR ?,?; ' Request relative distances 100,200 //controller response PRA=500; ' Set new relative distance for A BG; ' Begin. A will go 500 counts while B will go its previously set relative distance of 200. AMAB: ' Wait for motion on A and B to complete
PA
Position Absolute
The PA command sets the end target of the Position Absolute Mode of Motion. Units are counts.
PA 100,200; ' Set absolute position targets BG; ' Begin moves AMAB: ' Wait for motion on A and B to complete PA ?,?; ' Request absolute positions 100,200 //controller response PAA=500; ' Set new absolute distance for the A BG; ' Begin on all axes. A will go to position 500 while B will not move AMAB: ' Wait for motion on A and B to complete
SP
Speed
The SP command sets the slew speed of any or all axes for independent moves. Units are counts/sec.
PR 10000; ' Specify position AC 2000000; ' Specify acceleration rate DC 1000000; ' Specify deceleration rate SP 5000; ' Specify slew speed BG; ' Begin motion
AC
Acceleration
The AC command sets the linear acceleration of the motors for independent moves such as PR, PA, and JG moves. Unit are counts/sec^2.
PR 10000; ' Specify position AC 2000000; ' Specify acceleration rate DC 1000000; ' Specify deceleration rate SP 5000; ' Specify slew speed BG; ' Begin motion
DC
Deceleration
The DC command sets the linear deceleration of the motors for independent moves such as PR, PA, and JG moves. Unit are counts/sec^2.
PA 10000; ' Specify absolute position AC 2000000; ' Specify acceleration rate DC 1000000; ' Specify deceleration rate SP 5000; ' Specify slew speed BG; ' Begin motion
BG
Begin
The BG command starts a motion on the specified axis or sequence.
PR 10000,4000,,-8000; ' Specify positions for relative move on Axis A, B and D BG AD; ' Begin motion on Axis A and D AM AD; ' Wait for motion to complete on Axis A and D BG D; ' Begin motion on Axis B AM B; ' Wait for motion to complete on Axis B
ST
Stop
The ST command stops motion on the specified axis. Motors will come to a decelerated stop
ST A; ' Stop motion on the A axis SC A; ' Query A axis status 4 //controller response - Indicates stopped by ST command
AM
After Move
The AM command is a trippoint used to control the timing of events. This command will hold up execution of the following commands until the current move on the specified axis or axes is completed. Any combination of axes or a motion sequence may be specified with the AM command.
AM tests for profiler completion only. Use MC to test for physical motion to complete.
PR 4000; BGA ; ' make move AMA; ' wait for move to complete on A PR4000,2000; BG; ' make move on A and B AM; ' wait for move to complete on all axes
MC
Motion Complete
The MC command is a trippoint command that holds up execution until motion is complete on the specified axes. The MC command, unlike the AM (after motion command) requires that both the motion profiler has completed motion AND that the motor encoder has reached the specified position before continuing execution.
PR 4000; BGA; ' make move MCA; ' wait for motion to complete on A PR4000,2000; BG; ' make move on A and B MC; ' wait for motion to complete on all axes
WT
Wait
The WT command is a trippoint used to time events. When this command is executed, the controller will wait for the amout of time (msec) specified before executing the next command.
#A ; ' Program A PR 50000 ; ' Position relative move BGA ; ' Begin the move AMA ; ' After motion on A is complete WT 10000 ; ' Wait 10 seconds SB 1 ; ' Turn on relay (set output 1) WT 2000 ; ' Wait 2 seconds CB1 ; ' Turn off relay (clear output 1) EN ; ' End program
AI
After Input
The AI command is a trippoint used in motion programs to wait until after a specified input has changed state. This command can be configured such that the controller will wait until the input goes high or the input goes low.
AI 8;' wait until input 8 is high SP 10000; AC 20000; PR 4000; BGA;' make move AMA:' wait for move to complete AI -3;' wait until input 3 is low PA0; BGA:' make move AMA;' wait for move to complete
SB
Set Bit
The CB command sets a particular digital output. The SB and CB (Clear Bit) instructions can be used to turn on and off the state of digital outputs.
SB 5;' Set digital output 5 SB 1;' Set digital output 1 CB 5;' Clear digital output 5 CB 1;' Clear digital output 1
CB
Clear Bit
The CB command clears a particular digital output. The SB and CB (Clear Bit) instructions can be used to turn on and off the state of digital outputs.
SB 5;' Set digital output 5 SB 1;' Set digital output 1 CB 5;' Clear digital output 5 CB 1;' Clear digital output 1
#
Label Designator
The # denotes the name of a program label, for example, #move. Labels are often used to implement subroutines or loops. Labels are either user-defined or are reserved names, called “automatic subroutines”, that automatically execute when a particular event occurs.
7 characters max length. Labels can include the characters A-Z, a-z, 1-9. Numbers can not be the first character. All other characters are invalid.
#for sum=sum+i ; ' Add counter to sum i=i+1;' Increment counter JP#for,(i\<=10) ; ' Jump to #for label as long as is less than or equal to 10 EN
EN
End
The EN command is used to designate the end of a program or subroutine. If a subroutine was called by the JS command, the EN command ends the subroutine and returns program flow to the point just after the JS command.
#A; ' Program A PR 500 ; ' Move A axis forward 500 counts BGA ; ' Begin motion on A AMA ; ' Wait for motion to complete on A EN ; ' End of Program
XQ
Execute Program
The XQ command begins execution of a program residing in the program memory of the controller. Execution will start at the label or line number specified.
Up to 8 programs may be executed simultaneously to perform multitasking.
XQ #apple,0 ; ' Start execution at label apple as thread zero XQ #data,2 ; ' Start execution at label data as thread two
#AUTO
Subroutine to Automatically Run on Power-Up
Defines the automatic entry point of embedded DMC code. When power is applied to the controller, or after the controller is reset, the program will automatically begin executing at this label. When no host software is used with the controller, #AUTO is required to run an application program on the controller stand-alone.
'This code will run upon power up #AUTO;' Start on powerup SB 1;' Set bit 1 WT 500;' Wait 500msec CB 1;' Clear bit 1 WT 500;' Wait 500msec JP #AUTO;' Jump back to #AUTO
; (Semicolon)
Command Delimiter
The semicolon operator allows multiple Galil commands to exist on a single line.
SB1;WT500;CB1;' multiple commands separated by semicolons with a comment AC10000;SP4000;BGA;' multiple commands separated by semicolons with a comment
