Example
Instruction
Interpretation
JP #LOOP,P2CD< >3
Checks to see if status code is 3 (number received)
JP #P,P2CH="V"
Checks if last character received was a V
PR P2NM
Assigns received number to position
JS #XAXIS,P2ST="X"
Checks to see if received string is X
Using Communication Interrupt
The DMC-42x0 provides a special interrupt for communication allowing the application program to be interrupted
by input from the user. The interrupt is enabled using the CI command. The syntax for the command is CI n:
n = 0
Don't interrupt Port 2
n = 1
Interrupt on <enter> Port 2
n = 2
Interrupt on any character Port 2
n = -1
Clear any characters in buffer
The #COMINT label is used for the communication interrupt. For example, the DMC-42x0 can be configured to
interrupt on any character received on Port 2. The #COMINT subroutine is entered when a character is received
and the subroutine can decode the characters. At the end of the routine the EN command is used. EN,1 will re-
enable the interrupt and return to the line of the program where the interrupt was called, EN will just return to the
line of 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-42x0 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
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
Chapter 7 Application Programming ▫ 130
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...