
Example - Input Interrupt
Instruction
Interpretation
#A
Label #A
II 1
Enable input 1 for interrupt function
JG 30000,-20000
Set speeds on A and B axes
BG AB
Begin motion on A and B axes
#B
Label #B
TP AB
Report A and B axes positions
WT 1000
Wait 1000 milliseconds
JP #B
Jump to #B
EN
End of program
#ININT
Interrupt subroutine
MG "Interrupt has occurred"
Displays the message
ST AB
Stops motion on A and B axes
#LOOP;JP #LOOP,@IN[1]=0
Loop until Interrupt cleared
JG 15000,10000
Specify new speeds
WT 300
Wait 300 milliseconds
BG AB
Begin motion on A and B axes
RI
Return from Interrupt subroutine
Jumping back to main program with #ININT
To jump back to the main program using the JP command, the RI command must be issued in a subroutine and
then the ZS command must be issued prior to the JP command. See Application Note # 2418 for more information.
http://www.galilmc.com/support/appnotes/optima/note2418.pdf
Analog Inputs
The DMC-42x0 provides eight analog inputs. The value of these inputs in volts may be read using the @AN[n]
function where n is the analog input 1 through 8. The resolution of the Analog-to-Digital conversion is 12 bits (16-
bit ADC is available as an option). Analog inputs are useful for reading special sensors such as temperature, tension
or pressure.
The following examples show programs which cause the motor to follow an analog signal. The first example is a
point-to-point move. The second example shows a continuous move.
Example - Position Follower (Point-to-Point)
Objective - The motor must follow an analog signal. When the analog signal varies by 10V, motor must move
10000 counts.
Method: Read the analog input and command A to move to that point.
Instruction
Interpretation
#POINTS
Label
SP 7000
Speed
AC 80000;DC 80000
Acceleration
#LOOP
VP=@AN[1]*1000
Read and analog input, compute position
PA VP
Command position
BGA
Start motion
AMA
After completion
JP #LOOP
Repeat
EN
End
Example - Position Follower (Continuous Move)
Method: Read the analog input, compute the commanded position and the position error. Command the motor to
run at a speed in proportions to the position error.
Chapter 7 Application Programming ▫ 138
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...