DMC Commands Flashcards

1
Q

TP

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

DP

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

TE

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

RP

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

SH

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

MO

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

PR

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

PA

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

SP

A

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
~~~

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

AC

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

DC

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

BG

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

ST

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

AM

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

MC

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

WT

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

AI

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

SB

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

CB

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

#

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

EN

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

XQ

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

#AUTO

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

; (Semicolon)

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

JP

A

Jump to a Program Location

The JP command causes a jump to a program location on a specified condition. The program location may be any program line number or label. A jump is taken if the specified condition is true. Multiple conditions can be used in a single jump statement.

JP #C ; ' Jump to #C unconditionally
JP #POS1,(V1<5) ; ' Jump to label #POS1 if variable V1 is less than 5
JP #A,((V7*V8)=0) ; ' Jump to #A if V7 times V8 equals 0
JP #B,(@IN[1]=1) ; ' Jump to #B if input 1 = 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

JS

A

Jump to Subroutine

The JS command allows the program to jump to a subroutine and return back after completion. This command is often used to call reusable code.

#main;' Program Main
PR2000;SP4000;BGA;' make move
AMA;' wait for move to complete
JS#PULSE;' gosub to #PULSE
PR-2000;SP-4000;BGA;' make move
AMA;' wait for move to complete
JS#PULSE;' gosub to #PULSE
EN;' end of program
#PULSE
SB1;WT100;CB1;WT100;' turn on/off output1
EN;' end of subroutine - return to calling program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

IF

A

IF Conditional Statement

The IF command is used in conjunction with an ENDIF command to form an IF conditional statement. The arguments consist of one or more conditional statements and each condition must be enclosed with parenthesis (). If the conditional statement(s) evaluates true, the command interpreter will continue executing commands which follow the IF command. If the conditional statement evaluates false, the controller will ignore commands until the associated ENDIF command or an ELSE command occurs in the program.

#A
IF (_TPA<1000);' IF conditional statement based on a motor position
    MG "Motor is within 1000 counts of zero";' Message to be executed for true
ENDIF;' End of IF conditional statement
EN

#input
IF (@IN[1]=0);' IF conditional statement based on input 1
    MG "Input 1 is Low";' Message to be executed if "IF" statement is true
ENDIF;' End of IF conditional statement
EN

v1=@AN[1]*5;' some calculation for variable v1
IF((v1>25)&(@IN[4]=1));' Conditions based on V1 variable and input 4 status
    MG "Conditions met";' Message to be executed if "IF" statement is true
ENDIF;' End of IF statement
EN
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

ENDIF

A

End of IF Conditional Statement

The ENDIF command is used to designate the end of an IF conditional statement. An IF conditional statement is formed by the combination of an IF and ENDIF command. An ENDIF command must always be executed for every IF command that has been executed. It is recommended that the user not include jump commands inside IF conditional statements since this causes re-direction of command execution. In this case, the command interpreter may not execute an ENDIF command.

IF (@IN[1]=0);' IF conditional statement based on input 1
   IF (@IN[2]=0);' 2nd IF conditional statement executed if 1st IF conditional true
      MG "IN1 AND IN2 ARE ACTIVE";' Message if 2nd IF conditional is true
   ELSE;' ELSE command for 2nd IF conditional statement 
      MG "ONLY IN1 IS ACTIVE";' Message if 2nd IF conditional is false
   ENDIF;' End of 2nd conditional statement
ELSE;' ELSE command for 1st IF conditional statement
   IF (@IN[2]=0);' 3rd IF conditional statement executed if 1st IF conditional false
     MG "ONLY IN2 IS ACTIVE";' Message if 3rd IF conditional statement is true
   ELSE;' ELSE command for 3rd conditional statement
     MG "IN1 AND IN2 INACTIVE";'Message if 3rd IF conditional statement is false
    ENDIF;' End of 3rd conditional statement
ENDIF;' End of 1st conditional statement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

ELSE

A

ELSE Function for Conditional IF Statement

The ELSE command is an optional part of an IF conditional statement. The ELSE command must occur after an IF command and it has no arguments. It allows for the execution of a command only when the argument of the IF command evaluates False. If the argument of the IF command evaluates false, the controller will skip commands until the ELSE command. If the argument for the IF command evaluates true, the controller will execute the commands between the IF and ELSE command.

IF (@IN[1]=0);' IF conditional statement based on input 1
   IF (@IN[2]=0);' 2nd IF conditional statement executed if 1st IF conditional true
      MG "IN1 AND IN2 ARE ACTIVE";' Message if 2nd IF conditional is true
   ELSE;' ELSE command for 2nd IF conditional statement 
      MG "ONLY IN1 IS ACTIVE";' Message if 2nd IF conditional is false
   ENDIF;' End of 2nd conditional statement
ELSE;' ELSE command for 1st IF conditional statement
   IF (@IN[2]=0);' 3rd IF conditional statement executed if 1st IF conditional false
     MG "ONLY IN2 IS ACTIVE";' Message if 3rd IF conditional statement is true
   ELSE;' ELSE command for 3rd conditional statement
     MG "IN1 AND IN2 INACTIVE";'Message if 3rd IF conditional statement is false
    ENDIF;' End of 3rd conditional statement
ENDIF;' End of 1st conditional statement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

@IN

A

Read Digital Input

The @IN operand returns the value of the given digital input (either 0 or 1).

MG @IN[1]
1.0000

x = @IN[1] ; ' assign value of digital input 1 to variable
x = ? ; ' print value
1.000

JP #LOOPER,(@IN[2]=1) ; ' Jump to #LOOPER if input 2 = 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

@OUT

A

Read Digital Output

Returns the value of the given digital output (either 0 or 1)

MG @OUT[1] ; ' print value of digital output 1
1.0000

x = @OUT[1] ; ' assign state of digital output 1 to a variable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

@AN

A

Analog Input Query

The @AN[] operator returns the value of the given analog input in volts.

MG @AN[1] ; 'print analog input
1.7883

a1 = @AN[1] ; 'assign value of analog input 1 to variable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

AB

A

Abort

The AB command issues an abort to controller operation.

AB stops motion on all axes instantly without a controlled deceleration. If there is a program operating, AB can also be specified to abort the program and all running threads. The command, AB, will shut off the motors for any axis in which the off on error function is enabled (see command “OE”).

AB1; ' stop motion without aborting program
AB0; ' stop motion and program execution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

JG

A

Jog

The JG command sets the jog mode and the jog slew speed of the axes.

To stop motion use ST command.

JG 4000,-2000; ' Set jog mode and slew speeds
BG; ' Begin motion
WT1000; ' Wait 1000 msec
JGB= -4000; 'Change slew speed on B
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

AD

A

After Distance

The AD command is a trippoint to block command execution until a given distance is traversed. This is a profiled trippoint which means it depends on the motion profiler and not the actual motor encoder. AD can only be used when there is commanded motion on the axis.

#A
DP 0,0;' Zero position
PR 10000,20000;' Specify position relative moves
BG ;' Begin motion
AD 5000;' After A reaches 5000
MG "Halfway to A";TP A;' Send message
AD ,10000;' After B reaches 10000
MG "Halfway to B";TP B;' Send message
EN
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

AP

A

After Absolute Position

The AP command will hold up the execution of the following command until the actual motor position crosses the specified position. This trippoint does not rely on the profiler, but on actual encoder position.

#test
DP0;' Define zero
JG 1000;' Jog mode (speed of 1000 counts/sec)
BG A;' Begin move
AP 2000;' After passing the position 2000
V1=_TPA;' Assign V1 A position
MG "Position is", V1;' Print Message
ST;' Stop motion
EN;' End of Program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

KP

A

Proportional Gain Constant

KP designates the proportional constant in the controller filter. The proportional gain outputs a control signal proportional to the amount of error.

Affects the stiffness of the motor.

\:KP 12,14,16,20;' set a,b,c,d axis proportional term
\:KPC= 8;' set C proportional term only
\:KPC=? ; ' interrogate for C proportional term
8.0   //controller response
\:KP?,?,?,? ; ' interrogate for A,B,C,D values
12.0,14.0,8.0,20.0   //controller response
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

KD

A

Derivative Gain Constant

KD designates the derivative constant in the control filter. The derivative gain outputs a voltage based on the rate of change of the error.

Affects the damping (overshoot, undershoot) of the motor.

\:KD 60,72,55,81;' set a,b,c,d axis derivative term
\:KDC= 65;' set C derivative term only
\:KDC=? ; ' interrogate for C derivative term
65.0   //controller response
\:KD?,?,?,? ; ' interrogate for A,B,C,D values
60.0,72.0,65.0,81.0   //controller response
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

KI

A

Integrator Gain Constant

The KI command sets the integral gain of the control loop. The integrator term will reduce the position error at rest to zero.

\:K1 7,14,8,1;' set a,b,c,d axis derivative term
\:KIC= 2.1;' set C derivative term only
\:KDC=? ; ' interrogate for C derivative term
2.1   //controller response
\:KD?,?,?,? ; ' interrogate for A,B,C,D values
7.0,14.0,2.1,1.0   //controller response
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

AR

A

After Relative Distance

The AR command is a trippoint used to control the timing of events. This command will hold up the execution of the following command until one of the following conditions have been met:

  1. The commanded motor position crosses the specified relative distance from either the start of the move or the last AR or AD command.
  2. The motion profiling on the axis is complete.
  3. If in jog (JG) mode, the commanded motion is in the direction which moves away from the specified position.
#A;' Program A
DP 0;' Set position to zero
JG 50000;' Specify jog speed
BG A;' Begin motion
#B;' Label
AR 25000;' After passing 25000 counts of relative distance on A-axis
MG "Passed";TPA;' Send message on A-axis
JP #B;' Jump to Label #B
EN;' End Program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

AS

A

At Speed

The AS command is a trippoint that occurs when the generated motion profile has reached the specified speed. This command will hold up execution of the following command until the commanded speed has been reached. The AS command will operate after either accelerating or decelerating.

PR 100000;' Specify position
SP 10000;' Specify speed
BG A;' Begin move
AS A;' After speed is reached
MG "At Speed";' Print Message
42
Q

BN

A

Burn

The BN command saves certain board parameters in non-volatile EEPROM memory. Once written to the memory, all parameters which can be burned will persist through a software reset (RS command), hardware reset (reset button) or power cycle. This command typically takes 1 second to execute and must not be interrupted. The controller returns a colon (:) when the Burn is complete. All parameters which have been burned into memory can be restored to their factory defaults through a master reset.

AC10000,20000;' set accel
SP4000,-2000;' set speed
KP6.5,10;' set proportional gain
BN;' burn parameters
 :    //controller returns a colon when Burn is complete
43
Q

BP

A

Burn Program

The BP command saves the application program in non-volatile EEPROM memory. This command may take several seconds to execute and must not be interrupted. The controller returns a : when the Burn is complete.

#A
SB1;' set bit 1
WT1000;' wait 1000 msec
CB1;' clear bit 1
EN;' end of program
BP;' burn program to memory
 :   //controller returns a colon when Burn is complete
44
Q

BV

A

Burn Variables and Arrays

The BV command saves the controller variables and arrays in non-volatile EEPROM memory. This command typically takes up to 2 seconds to execute and must not be interrupted. The controller returns a : when the Burn is complete.

BV;' burn in variables
 :   //controller returns a colon when Burn is complete
45
Q

MG

A

Message

The MG command is used to send strings, operands, variables, and array values to a specified destination.

MG _TPA ; ' print position of A
-4000

total= 1234.5322 ; 'Assign value to variable
MG "The answer is...",total{F4.2}
The answer is... 1234.53
46
Q

TT

A

Tell Torque

The TT command reports the value of the motor command analog output signal, which is a number between -9.9982 and 9.9982 volts.

TTA ; ' Report torque on A
-0.2843

v1=_TTA ; ' Assigns value of TTA to variable
47
Q

ER

A

The ER command sets the magnitude of the position errors for each axis that will trigger an error condition. When the limit is exceeded, the Error output will go low (true) and the controller’s red light will be turned on. If the Off On Error (OE1) command is active, the motors will be disabled.

ER 200,300,400,600;' Set error limits on A,B,C,D axes
ER ,1000;' Sets the B-axis error limit to 1000, leave the A-axis error limit unchanged.
ER ?,?,?,?;' Return A,B,C and D values
200,1000,400,600
ER ?;' Return A value 200
V1=_ERA;' Assigns V1 value of ERA
MG V1;' Returns ## Footnote V1
200
48
Q

OE

A

Off-On-Error

The OE command sets the Off On Error function for the controller. The OE command causes the controller to shut off the motor command if a position error exceeds the limit specified by the ER command, an abort occurs from either the abort input or on AB command, or an amplifier error occurs based on the description of the TA command.

OE 1,1,1,1;' Enable OE on all axes
OE 0;' Disable OE on A-axis, other axes remain unchanged
OE ,,1,1;' Enable OE on C-axis and D-axis, other axes remain unchanged
OE 1,0,1,0;' Enable OE on A and C-axis, Disable OE on B and D axis
MG _OEA;' Query A axis OE setting
1.0000
49
Q

MT

A

Motor Type

The MT command selects the type of the motor and the polarity of the drive signal. Motor types include standard servomotors, which require a voltage in the range of +/- 10 Volts, and stepper motors, which require step and direction signals. The polarity reversal inverts the analog signals for servomotors, or inverts logic level of the pulse train for step motors.

MO; 'turn all motors off
MT 1,-1,2,2; 'Configure A as servo, B as reverse servo, C and D as steppers
50
Q

CE

A

Configure Encoder

The CE command configures the encoder to quadrature type or pulse and direction type. It also allows inverting the polarity of the encoders which reverses the direction of the feedback. The configuration applies independently to the main axes encoders and the auxiliary encoders.

CE 0, 3, 6, 2;' configure encoders

51
Q

CN

A

Configure

The CN command configures the polarity of the limit switches, home switches, latch inputs, the selective abort function, and the program termination behavior of the abort input.

#test
CN -1;' Limit switches are active low
JGA= 100; BG A;' Start a slow jog move
WT1000; ' Wait 1000 msec
CN 1;' Cause a limit fault by inverting the limit polarity
EN
#LIMSWI;' Automatic sub will automatically launch on limit detection
MG "Limit Switch Routine"
WT100
CN -1;' Return to correct polarity
RE
52
Q

TR

A

Trace

The TR command causes each instruction in a program to be sent out the communications port prior to execution. The trace command is useful in debugging programs.

TR1 ; ' turn on trace mode
TR0 ; ' turn off trace mode
53
Q

FE

A

Find Edge

The FE command moves a motor until a transition is seen on the home input for that axis. The direction of motion depends on the initial state of the homing input (use the CN command to configure the polarity of the home input). Once the transition is detected, the motor decelerates to a stop.

This command is useful for creating custom homing sequences.

FECD; ' Find edge on C and D
BGCD; ' Begin motion C and D
54
Q

FI

A

Find Index

The FI and BG commands move the motor until an encoder index pulse (Z-channel) is detected.

#home
JG -2000 ; ' Set the speed and direction for the first phase of the FI move
HV 500; ' Set the speed for the second phase of the FI move
FI A; ' Queue up a find edge move on the A axis - direction of phase 2 is opposite of phase 1
BG A; ' Begin FI move on A axis
AM A; ' After the move has finished on axis A
MG "FI done"; ' Output a message indicating the FI move is complete
EN
55
Q

HM

A

Home

The HM command performs a three stage homing sequence for servo systems and a two stage sequence for stepper motors.

HM; ' Set Homing Mode for all axes
BG; ' Home all axes

HMA; ' Set Homing Mode for axis A
BGA; ' Home only the A-axis
56
Q

HV

A

Homing Velocity

The HV command sets the slew speed for the FI final move to the index and all but the first stage of HM.

HVA=1000; ' set homing speed
HMA; ' home to home switch then index
BGA; ' begin motion
AMA; ' wait for motion complete
57
Q

HX

A

Halt Execution

The HX command halts the execution of any program that is running.The parameter n specifies the thread to be halted.

XQ #A; ' Execute program #A, thread zero
XQ #B,3; ' Execute program #B, thread three
HX0; ' Halt thread zero
HX3; ' Halt thread three
58
Q

GA

A

Master Axis for Gearing

The GA command specifies the master axes for electronic gearing. Multiple masters for gearing may be specified. A slave axis may have only one master. The masters may be the main encoder input, auxiliary encoder input, or the commanded position of any axis. The master may also be the commanded vector move in a coordinated motion of LM or VM type. When the master is a simple axis, it may move in any direction and the slave follows. When the master is a commanded vector move, the vector move is considered positive and the slave will move forward if the gear ratio is positive, and backward if the gear ratio is negative. The slave axes and ratios are specified with the GR command and gearing is turned off by the command GR0.

#gear
MO B;' Turn off servo to B motor
GA B,,B;' Specify master axis as B on A and C
GR .25,,-5;' Specify A and C gear ratios
SH B;' Enable B axis
PRB= 1000;BG B;' Move B axis 1000 counts
' A axis will be commanded to move 250 counts positive
' C axis will be commanded to move -5000 counts
EN;' End program
59
Q

GR

A

Gear Ratio

GR specifies the Gear Ratios for the geared axes in the electronic gearing mode. The master axis is defined by the GA command.

#gear
MO B;' Turn off servo to B motor
GA B,,B;' Specify master axis as B on A and C
GR .25,,-5;' Specify A and C gear ratios
SH B;' Enable B axis
PRB= 1000;BG B;' Move B axis 1000 counts
' A axis will be commanded to move 250 counts positive
' C axis will be commanded to move -5000 counts
EN;' End program
60
Q

GM

A

Gantry Mode

The GM command specifies the axes in which the gearing function is performed in the Gantry mode. In this mode, the geared slaves will not be stopped by the ST command or by limit switches.

GA DA;' Set master for A axis to the A axis Aux encoder input
GM 1;' Enable Gantry Mode on A axis
GR 1;' Set Gear Ratio to 1
WT 1000
ST;' Axis will still be in gearing mode
WT 1000
GM 0;' Disable Gantry Mode (Axis still gearing)
WT 1000
ST;' Will clear gearing mode
EN
61
Q

IP

A

Increment Position

The IP command allows for a change in the command position while the motor is moving. This command does not require a BG.

#CORRECT
AC 100000; ' Set acceleration
JG 10000; BGA; ' Jog at 10000 counts/sec rate
WT 1000; ' Wait 1000 msec
IP 10; ' Move the motor 10 counts instantaneously
STA; ' Stop Motion
EN
62
Q

AG

A

Amplifier Gain

The AG command sets the amplifier current/voltage gain for the Galil internal amplifiers.

MO;' Turn motor off
MT 1;' Set the A axis as a servo
AG 2;' Sets the highest amplifier gain for A axis on servo amplifier
63
Q

TL

A

Torque Limit

The TL command sets the limit on the motor command output. This limit is designed to prevent over current to motors with lower current rating than the drive.

To convert motor command output (V) to actual motor current (A), use the following equation: Motor Current (A) = Motor Command (V) * Amplifier Gain (A/V).

TL 5.0, 9.9982 ; ' limit A to 5.0 volts; B set to max 9.9982 volts
TL ?,?;' return torque limits
5.0 , 9.9982   //controller response
64
Q

BW

A

Brake Wait

The BW command sets the delay between when the brake is turned on (1) and when the amp is turned off (2). When the controller goes into a motor-off (MO) state, this is the time (in samples) between when the brake digital output changes state and when the amp enable digital output changes state. The brake is actuated immediately upon MO and the delay is to account for the time it takes for the brake to engage mechanically once it is energized electrically. The brake is released immediately upon SH.

Typically used with Galil internal amplifiers.

Outputs 1-8 are used for Axes A-H, where output 1 is the brake for axis A and output 2 is the brake for axis B and so on.

BW 100;' Set brake delay to 100 ms (TM1000) for the A axis
EN
65
Q

MF

A

Forward Motion to Position

The MF command will hold up the execution of the following command until the specified motor moves forward and crosses the position specified. Command references absolute position.

DP 0; 'Define zero
JG 1000; 'Jog mode (speed of 1000 counts/sec)
BG A; 'Begin move
MF 2000; 'After passing the position 2000
v1= _TPA; 'Assign V1 A position
MG "Position is",v1; 'Print Message
ST A; 'Stop motion
66
Q

MR

A

Reverse Motion to Position

The MR command will hold up the execution of subsequent DMC code until the specified axis moves backwards and crosses the position specified. Command references absolute position.

DP 0; 'Define zero
JG -1000; 'Jog mode (speed of -1000 counts/sec)
BG A; 'Begin move
MR -3000; 'After passing the position -3000
v1= _TPA; 'Assign V1 A position
MG "Position is",v1; 'Print Message
ST A; 'Stop motion
67
Q

NO

A

No Operation

The NO (or ‘) command performs no action in a sequence and can be used as a comment in a program. NO (or ‘) command lines are downloaded to the controller and do take some execution time.

#A; 'Program A
NO; ' No operation
NO This Program; ' No operation
NO Does Absolutely; ' No operation
NO Nothing; ' No operation
EN; 'End of program
68
Q

REM

A

Remark

REM is used for comment lines. The REM statement is NOT a controller command. Rather, it is recognized by Galil PC software, which strips away the REM lines before downloading the DMC file to the controller.

REM differs from NO (or ‘) in the following ways:

  • NO (or ‘) comments are downloaded to the controller and REM comments are not.
  • NO (or ‘) comments take up execution time and REM comments don’t; therefore, REM should be used for code that needs to run fast.
  • REM comments cannot be recovered when uploading a program but NO (or ‘) comments are recovered. Thus the uploaded program is less readable with REM.
  • NO (or ‘) comments take up program line space and REM lines do not.
  • REM comments must be the first and only thing on a line, whereas NO (or ‘) can be used to place comments to the right of code (after a semicolon) on the same line.
REM This comment will be stripped when downloaded to the controller
'This comment will be downloaded and takes some execution time
SB1 ;'this comment is to the right of the code and will be downloaded to the controller
69
Q

OP

A

Output Port

The OP command sets the output ports of the controller in a bank using bitmasks (ie: use OP to set multiple outputs in a bank with a single command). Arguments to the OP command are bit patterns (decimal or hex) to set entire banks (bytes) of digital outputs. Use SB, CB or OB to set bits individually.

OP $85;' Set outputs 1,3,8 and clear the others
OP 0;' Clear all bits
70
Q

AL

A

Arm Latch

The AL command enables the latch function (high speed main or auxiliary position capture) of the controller. When the position latch is armed, the main or auxiliary encoder position will be captured upon a rising or falling edge on the specified digital input. Use the CN command to configure the edge that the latch input will trigger on.

The command RL returns the latched position.

_ALm contains the state of the specified latch. 0 = not armed, 1 = armed

#start
AL A;' Arm A-axis latch
JG 50000;' Set up jog move
BG A;' Begin the move
#loop;' Loop until latch has occurred
JP #loop,(_ALA=1)
RL A;' Transmit the latched position
EN
71
Q

RL

A

Report Latched Position

The RL command will return the last position captured by the latch. The latch must first be armed by the AL command and then the appropriate input must be activated. Each axis uses a specific general input for the latch input; see the AL command for information on latch inputs.

JG ,5000;' Set up to jog the B-axis
BG B;' Begin jog
AL B;' Arm the B latch, assume that after about 2 seconds, input goes low
RL B;' Report the latch
10000
72
Q

TC

A

Tell Error Code

The TC command reports programming or command errors detected by the controller. The TC command returns a number between 1 and 255. This number is a code that reflects why a command was not accepted by the controller. This command is useful when the controller halts execution of a program or when the response to a command is a question mark.

Refer to table in Command Reference for listing of error codes.

TC1; ' Tell error code with numerical code and human readable message
20   Begin not valid with motor off   //controller response

TC0 ; ' Tell error code with numerical code only
20   //controller response
73
Q

SC

A

Stop Code

The SC command returns a number indicating why a motor has stopped.

Refer to table in Command Reference for listing of stop codes.

JG10000;' Set jog speed
BGA;' Start jogging
SCA;' Return Stop Code
0   //Controller Response - Axis is running in independent mode
STA;' Stop motion on A
SCA;' Return Stop COde
4   //Controller Response - Axis is stopped by ST command
74
Q

TS

A

Tell Switches

The TS command returns information including axis-specific IO status, error conditions, motor condition and state. The value returned by this command is decimal and represents an 8 bit value (decimal value ranges from 0 to 255).

Refer to table in Command Reference for listing of status bit codes.

V1=TSB;’ Assigns value of TSB to the variable V1
V1=?;’ Interrogate value of variable V1
15 // Controller Response - Decimal value corresponding to bit pattern 00001111
Y axis not in motion (bit 7 - has a value of 0)
Y axis error limit not exceeded (bit 6 has a value of 0)
Y axis motor is on (bit 5 has a value of 0)
Y axis forward limit is inactive (bit 3 has a value of 1)
Y axis reverse limit is inactive (bit 2 has a value of 1)
Y axis home switch is high (bit 1 has a value of 1)
Y axis latch is not armed (bit 0 has a value of 1)

75
Q

TA

A

Tell Amplifier Error Status

The TE command returns the error status of Galil internal amplifiers. The value is decimal and represents an 8 bit value. Bit 7 is the most significant bit. Bit 0 is the least significant bit.

Refer to table in Command Reference for listing of error codes.

TA1
1   //bit 0 means Hall error for A axis
TA0
8   //bit 3 means under voltage error for amp
76
Q

TB

A

Tell Status Byte

TThe TB command returns status information from the controller as a decimal number. Each bit of the status byte denotes an active condition when the bit is set (high):

Refer to table in Command Reference for listing of status bit codes.

TB;' Tell status information
129   //Executing program and echo on (2^7 + 2^0 = 128 + 1 = 129)
77
Q

TD

A

Tell Dual Encoder

The TD command returns the current position of the dual (auxiliary) encoder input. When operating with stepper motors, the TD command returns the number of counts that have been output by the controller.

TD ; ' Return A,B,C,D aux encoder positions
200, -10, 0, -110   //controller response
TDA ; ' Return the A aux encoder position
200   //controller response
dual=_TDA ; ' Assign value of TDA to variable
78
Q

TH

A

Tell Ethernet Handle

The TH command returns a list of data pertaining to the Galil’s Ethernet connection. This list begins with the IP address and Ethernet address (physical address), followed by the status of each handle indicating connection type and IP address.

TH
CONTROLLER IP ADDRESS 10,51,0,87 ETHERNET ADDRESS 00-50-4C-08-01-1F
IHA TCP PORT 1050 TO IP ADDRESS 10,51,0,89 PORT 1000
IHB TCP PORT 1061 TO IP ADDRESS 10,51,0,89 PORT 1001
IHC TCP PORT 1012 TO IP ADDRESS 10,51,0,93 PORT 1002
IHD TCP PORT 1023 TO IP ADDRESS 10,51,0,93 PORT 1003
IHE TCP PORT 1034 TO IP ADDRESS 10,51,0,101 PORT 1004
IHF TCP PORT 1045 TO IP ADDRESS 10,51,0,101 PORT 1005
IHG AVAILABLE
IHH AVAILABLE
79
Q

TI

A

Tell Inputs

The TI command returns the state of the inputs in banks of 8 bits, or 1 byte. The value returned by this command is decimal and represents an 8 bit value (decimal value ranges from 0 to 255). Each bit represents one input where the LSB is the lowest input number and the MSB is the highest input bit.

TI1 ; ' Tell input state on bank 1
8   //Bit 3 is high, others low
TI0
0   //All inputs on bank 0 low
input1=_TI1 ; ' Assign value of Bank 1 inputs to variable
input1=?
8.0000   //controller response
80
Q

OB

A

Output Bit

The OB command allows variable control of an output bit based on logical expressions. The OB command defines output bit n as either 0 or 1 depending on the result from the logical expression.

OB 1, pos;' If pos<>0, Bit 1 is high.
' If pos=0, Bit 1 is low
OB 2, @IN[1]&@IN[2];' If Input 1 and Input 2 are both high, then Output 2 is set high
OB 3, count[1];' If the element 1 in the array is zero, clear bit 3
OB n, count[1];' If element 1 in the array is zero, clear bit
81
Q

TV

A

Tell Velocity

The TV command returns the actual velocity of the axes in units of encoder count/s. The value returned includes the sign bit for direction.

TVA;' Returns the A-axis velocity 3420
vela=_TVA;' Assigns value of A-axis velocity to the variable VELA
82
Q

_LF

A

Forward Limit Switch Operand

The _LF operand contains the state of the forward limit switch input.

MG _LFA;' Display the status of the A axis forward limit switch
83
Q

_LR

A

Reverse Limit Switch Operand

The _LR operand contains the state of the reverse limit switch input.

MG _LRA;' Display the status of the A axis reverse limit switch
84
Q

LD

A

Limit Disable

The LD command allows user to disable forward and/or reverse limit switches.

LDA=0;' enable both limits on A
LD0,3:' enable both limits on A and disable both limits on B
85
Q

#LIMSWI

A

Limit Switch Automatic Subroutine

#LIMSWI is an automatic sub for running user-defined code on a limit switch event. A limit switch event requires the following conditions.

  • Motion profiling in the direction of the given limit. I.E. RPm increasing for forward switch, RPm decreasing for reverse switch.
  • Limit switch toggles active, either a hardware or software limit. See CN for inverting the active sense of the limit swithes.

Without #LIMSWI defined, the controller will issue ST on the axis when its limit switch is tripped during motion in the direction of the switch. With #LIMSWI defined, code is executed in addition to the stop.

In lieu of a controlled stop, the motor can turn off and coast stop in the event of a limit switch event. See OE for this feature.

#LIMSWI ;' runs when a limit switch is tripped
MG "Limit`` switch:"{N}
IF ((_LFA = 0) | (_LRA = 0));' if either A forward or reverse limit is prohibiting motion
 MG "Axis A Limit Hit";' print message
ENDIF
IF ((_LFB = 0) | (_LRB = 0));' if either B forward or reverse limit is prohibiting motion
 MG "Axis B Limit Hit";' print message
ENDIF
RE1;' RE used to exit the #LIMSWI sub
86
Q

FL

A

Forward Soft Limit

The FL command sets the forward software position limit. If this limit is exceeded during motion, motion on that axis will decelerate to a stop. Forward motion beyond this limit is not permitted.

  • When the forward software limit is activated, the automatic subroutine #LIMSWI will be executed if it is included in the program.
#test
AC 1000000;DC 1000000;' Set Accel/Decel
FL15000;' Forward Limit
JG 5000;' Jog Forward
BGA;' Begin
AMA;' After Limit
RPA;' Tell Position
EN;' End
87
Q

BL

A

Reverse Soft Limit

The BL command sets the reverse software limit. If this limit is exceeded during motion, motion on that axis will decelerate to a stop. Reverse motion beyond this limit is not permitted.

  • When the reverse software limit is activated, the automatic subroutine #LIMSWI will be executed if it is included in the program.
#test
AC 1000000;DC 1000000;' Set Accel/Decel
BL-15000;' Reverse Limit
JG -5000;' Jog Reverse
BGA;' Begin
AMA;' After Limit
RPA;' Tell Position
EN;' End
88
Q

SD

A

Limit Switch Deceleration

The SD command sets the linear deceleration rate of the motors when a limit switch has been reached.

#main
PR 10000;' Specify position
AC 2000000;' Specify acceleration rate
DC 1000000;' Specify deceleration rate
SD 5000000;' Specify Limit Switch Deceleration Rate
SP 5000;' Specify slew speed
EN
89
Q

RE

A

Return from Error Routine

The RE command is used to end subroutines in application code. An RE at the end of these routines causes a return to the main program. Specific automatic error subroutines require the use of the RE command to end the code correctly.

#A
JP #A
EN
#POSERR;' Begin Error Handling Subroutine
MG "ERROR";' Print message
SB1;' Set output bit 1
RE;' Return to main program and clear trippoint

~~~

90
Q

DM

A

Dimension Array

The DM command defines a single-dimensional array with a name and n total elements. The first element of the defined array starts with element number 0 and the last element is at n-1.

DM Pets[5],Dogs[2],Cats[3] ; ' Define arrays - Pets w/ 5 elements, Dogs w/ 2 , Cats w/ 3
DM Tests[100] ; ' Define dimension of array Tests with 100 elements
91
Q

II

A

Input Interrupt

The II command enables the input interrupt function for the specified inputs.

The II command is used along with the #ININT subroutine to execute specific code when inputs specified by II are in the desired state.

II 1,1,,0;' Specify interrupt on input 1 only, and triggers when input 1 = 0
EN;' End Program
#ININT;' Interrupt subroutine
' The code the user wants to run when II triggers goes here.
WT100;' Debounce the input.
RI 1;' Return to main program, re-enabling trip point.
' Specify RI 0 if it is not desired to re-enable trip points.
92
Q

#ININT

A

Input Interrupt Automatic Subroutine

The #ININT subroutine is used to execute specific code when inputs specified by the II command are in the desired state.

II 1,1,,0;' Specify interrupt on input 1 only, and triggers when input 1 = 0
EN;' End Program
#ININT;' Interrupt subroutine
' The code the user wants to run when II triggers goes here.
WT100;' Debounce the input.
RI 1;' Return to main program, re-enabling trip point.
' Specify RI 0 if it is not desired to re-enable trip points.
93
Q

#POSERR

A

Position Error Automatic Subroutine

#POSERR is an automatic subroutine that runs user code when a position error event occurs. The factory default behavior of the Galil controller upon a position error (_TEn > _ERn) is to drive the error signal low only, turning on the red error LED. If OE is set to 1, the motor whose position error (TE) equals or exceeds its threshold (ER) will be turned off (MO). #POSERR is used to run code upon a position error, for example to notify a host computer.

REM how to recover from position error on the A axis
#POSERR
ST; ' stop commanding motion to all axes
AM; ' wait until motion is halted
MO; ' disable all axes
MG "Position error occurred"; ' send message indicating position error occured
SHA; 'reenable A axis, position error is cleared
EN
94
Q

IA

A

IP Address

The IA command assigns the controller IP address and the TCP time out. The IP address can also be assigned via Galil software or from an external server.

The controller defaults to DHCP and will receive an IP address from a DHCP server if present. To manually set an IP address over the serial connection, send DH0 to disable DHCP prior to setting the new IP address with IA.

IA 192,168,1,43;' Assigns the controller with IP address
1.168.1.43   //controller response
IA < 500;' Sets the timeout value to 500 msec
95
Q

SM

A

Subnet Mask

The SM command assigns a subnet mask to the controller. All packets sent to the controller whose source IP address is not on the subnet will be ignored by the controller. For example, for SM 255,255,0,0 and IA 10,0,51,1, only packets from IP addresses of the form 10.0.000.000 will be accepted.

SM 255,255,255,255;' Ignore all incoming Ethernet packets
SM 0,0,0,0;' Process all incoming Ethernet packets
96
Q

IH

A

Open IP Handle

The IH command is used when the controller is operated as a master (client) to open a handle and connect to a slave (server).

'setting up a modbus handle
MW1;' setup modbus wait
IHE= 192,168,100,200<502>2;' setup a modbus handle to slave
#wt;' wait for handle to be connected
WT2;' before issuing a command
JP#wt,_IHE2<>-2;'
SB5003;' Set output 3 on slave
WT1000;' 1 second wait
MBE= ,5,3,0;' Clear output 3 using MB command
EN
97
Q

^L^K

A

Lock Program

^L^K locks/unlockes user access to the application program. When locked, the ED, UL, LS, and TR commands will give privilege error #106. The application program will still run when locked. Once the program is unlocked, it will remain accessible until a lock command or a reset (with the locked condition burned in) occurs. Used in conjunction with PW password command.

PW test,test;' Set password to "test"
^L^K test,1;' Lock the program
LS;' Attempt to list the program
?   //controller response
TC 1
106 Privilege violation   //controller response

\:^L^K test,0;' Unlock the program
98
Q

PW

A

Password

The PW command sets the password used to lock the controller. Locking the controller prevents interrogation of the controller program space. Used in conjunction with the ^L^K lock command.

PWtest,test;' set password to "test"
^L^K test,1;' lock the program

PWapple,orange ; 'set passwords that do not match
?   //invalid response from controller
TC1 ; ' interrogate for error code
138 Passwords not identical    //response from controller
PWapple,apple ; ' correctly set password to "apple"
^L^K apple,1 ; ' lock the program

^L^K apple,0 ; ' unlock the program
99
Q

RS

A

Reset

The RS command resets the state of the processor to its power-on condition. The previously saved state of the hardware, along with parameter values and saved program, are restored.

Use ^R^S command for master reset.or use MRST hardware jumper method.

KP10; ' set proportional gain
BN; ' burn to non-volatile memory
RS: ' perform soft reset
KP? ; ' interrogate for KP value
10   //controller response - value was saved
^R^S; ' perform master reset
KP? ; ' interrogate for KP value
6.00   //controller response - factory default value
100
Q

^R^S

A

Master Reset

The Master Reset command resets the controller to factory default settings and erases EEPROM. A master reset can also be performed by installing a jumper at the location labeled MRST and resetting the board (power cycle or pressing the reset button). Remove the jumper after this procedure.

Use RS command for soft reset.

KP10; ' set proportional gain
BN; ' burn to non-volatile memory
RS; ' perform soft reset
KP? ; ' interrogate for KP value
10   //controller response - value was saved
^R^S; ' perform master reset
KP? ; ' interrogate for KP value
6.00    //controller response - factory default value
101
Q

LV

A

List Variables

The LV command returns a listing of all of the program variables in memory. The listing will be in alphabetical order.

LV is an interrogation command with no parameters.

 :LV
apple = 60.0000 
banana = 25.0000 
zebra = 37.0000
 :
102
Q
A