the program where it was called without re-enabling the interrupt. As with any automatic subroutine, a program
must be running in thread 0 at all times for it to be enabled.
Example
A DMC-40x0 is used to jog the A and B axis. This program automatically begins upon power-up and allows the
user to input values from the main serial port terminal. The speed of either axis may be changed during motion by
specifying the axis letter followed by the new speed value. An S stops motion on both axes.
Instruction Interpretation
#AUTO Label for Auto Execute
speedA=10000 Initial A speed
speedB=10000 Initial B speed
CI 2 Set Port 2 for Character Interrupt
JG speedA, speedB Specify jog mode speed for A and B axis
BGXY Begin motion
#PRINT Routine to print message to terminal
MG{P2}"TO CHANGE SPEEDS" Print message
MG{P2}"TYPE A OR B"
MG{P2}"TYPE S TO STOP"
#JOGLOOP Loop to change Jog speeds
JG speedA, speedB Set new jog speed
JP #JOGLOOP
EN End of main program
#COMINT Interrupt routine
JP #A,P2CH="A" Check for A
JP #B,P2CH="B" Check for B
JP #C,P2CH="S" Check for S
ZS1;CI2;JP#JOGLOOP Jump if not X,Y,S
#A;JS#NUM
speedX=val New X speed
ZS1;CI2;JP#PRINT Jump to Print
#B;JS#NUM
speedY=val New Y speed
ZS1;CI2;JP#PRINT Jump to Print
#C;ST;AMX;CI-1 Stop motion on S
MG{^8}, "THE END"
ZS;EN,1 End-Re-enable interrupt
#NUM Routine for entering new jog speed
MG "ENTER",P2CH{S},"AXIS
SPEED" {N}
Prompt for value
#NUMLOOP; CI-1 Check for enter
#NMLP Routine to check input from terminal
JP #NMLP,P2CD<2 Jump to error if string
JP #ERROR,P2CD=2 Read value
val=P2NM
EN End subroutine
#ERROR;CI-1 Error Routine
MG "INVALID-TRY AGAIN" Error message
JP #NMLP
EN End
Chapter 7 Application Programming • 159 DMC-40x0 User Manual