94
•
Chapter 7 Application Programming
DMC-1500
Logical Operators:
OPERATOR DESCRIPTION
< less
than
> greater
than
= equal
to
<=
less than or equal to
>=
greater than or equal to
<> not
equal
Subroutines
A subroutine is a group of instructions beginning with a label and ending with an end command (EN).
Subroutines are called from the main program with the jump subroutine instruction JS, followed by a
label or line number, and conditional statement. Up to 8 subroutines can be nested. After the
subroutine is executed, the program sequencer returns to the program location where the subroutine
was called unless the subroutine stack is manipulated as described in the following section.
Example - Using a Subroutine
Subroutine to draw a square 500 counts on each side. The square starts at vector position 1000,1000.
Instruction Interpretation
#M
Begin main program
CB1
Clear Output Bit 1 (pick up pen)
VMXY
Specify vector motion between X and Y axes
VP 1000,1000;VE;BGS
Define vector position; move pen
AMS
Wait for after motion trippoint
SB1
Set Output Bit 1 (put down pen)
JS #Square;CB1
Jump to square subroutine
EN
End main program
#Square Square
subroutine
V1=500;JS #L
Define length of side, Jump to subroutine #L
V1=-V1;JS #L
Switch direction, Jump to subroutine #L
EN
End subroutine #Square
#L;PR V1,V1;BGX
Subroutine #L, Define relative position movement on X and Y; Begin motion
AMX;BGY;AMY
After motion on X, Begin Y, Wait for motion on Y to complete
EN
End subroutine #L
Stack Manipulation
It is possible to manipulate the subroutine stack by using the ZS command. Every time a JS
instruction, interrupt or automatic routine (such as #POSERR or #LIMSWI) is executed, the
subroutine stack is incremented by 1. Normally the stack is restored with an EN instruction.
Occasionally it is desirable not to return back to the program line where the subroutine or interrupt was
called. The ZS1 command clears 1 level of the stack. This allows the program sequencer to continue
to the next line. The ZS0 command resets the stack to its initial value. For example, if a limit occurs
and the #LIMSWI routine is executed, it is often desirable to restart the program sequence instead of
returning to the location where the limit occurred. To do this, give a ZS command at the end of the
#LIMSWI routine.
Содержание DMC-1510
Страница 6: ......
Страница 18: ...6 Chapter 1 Overview DMC 1500 THIS PAGE LEFT BLANK INTENTIONALLY...
Страница 88: ...76 Chapter 6 Programming Motion DMC 1500 Figure 6 7 Motion intervals in the Home sequence...
Страница 90: ...78 Chapter 6 Programming Motion DMC 1500 THIS PAGE LEFT BLANK INTENTIONALLY...
Страница 137: ...DMC 1500 Chapter 7 Application Programming 125 THIS PAGE LEFT BLANK INTENTIONALLY...
Страница 157: ...DMC 1500 Chapter 10 Theory of Operation 145 THIS PAGE LEFT BLANK INTENTIONALLY...
Страница 160: ...148 Appendices DMC 1500 Card Level Layout...
Страница 178: ...166 Appendices DMC 1500 ICM 1100 Drawing 1 3 4 0 0 4 4 0 2 4 0 7 0 0 4 5 3 7 0 5 7 0 2 8 5 1 0 0 1 0 1 0 7 0 1 0 0...
Страница 180: ...168 Appendices DMC 1500...
Страница 198: ...186 Appendices DMC 1500 THIS PAGE LEFT BLANK INTENTIONALLY...