100
•
Chapter 7 Application Programming
DMC-1000
Example - Bad Command
Instruction Interpretation
#BEGIN
Begin main program
IN "ENTER SPEED", SPEED
Prompt for speed
JG SPEED;BGX;
Begin motion
JP #BEGIN
Repeat
EN
End main program
#CMDERR
Command error utility
JP#DONE,_ED<>2
Check if error on line 2
JP#DONE,_TC<>6
Check if out of range
MG "SPEED TOO HIGH"
Send message
MG "TRY AGAIN"
Send message
ZS1 Adjust
stack
JP #BEGIN
Return to main program
#DONE
End program if other error
ZS0 Zero
stack
EN End
program
The above program prompts the operator to enter a jog speed. If the operator enters a number out of
range (greater than 8 million), the #CMDERR routine will be executed prompting the operator to enter
a new number.
Mathematical and Functional Expressions
Mathematical Expressions
For manipulation of data, the DMC-1000 provides the use of the following mathematical operators:
OPERATOR FUNCTION
+ Addition
- Subtraction
* Multiplication
/ Division
&
Logical And (Bit-wise)
|
Logical Or (On some computers, a solid vertical line appears as a broken line)
() Parenthesis
The numeric range for addition, subtraction and multiplication operations is +/-2,147,483,647.9999.
The precision for division is 1/65,000.
Mathematical operations are executed from left to right. Calculations within a parentheses have
precedence.
Examples of MATHEMATICAL EXPRESSION
SPEED=7.5*V1/2
The variable, SPEED, is equal to 7.5 multiplied by V1 and divided by 2
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com