ENDIF
#PWRHLPR
^c=^c*^a
^b=^b-1
JP
#PWRHLPR,^
b>0
IF
^d=1
;'if inversion required
^c=(1/^c)
ENDIF
EN
,,^c
Executed program from program1.dmc
4.0000
65536.0000
0.0039
Example: Recursion
'although the stack depth is only 16, Galil DMC code does support recursion
JS
#AxsInfo
(0)
MG
{Z2.0}
"Recursed through "
,
_JS
,
" stacks"
EN
'
#AxsInfo
;NO(axis ^a) List info for axes
~h=^a
^b=(^a+$41)*$1000000
;'convert to Galil String
MG
^b{S1},
" Axis: "
{N}
MG
{F8.0
}"Position: "
,
_TP
~h,
" Error:"
,
_TE
~h,
" Torque:"
,
_TT
~h{F1.4}
IF
^a=7
;'recursion exit condition
EN
,,1
ENDIF
JS
#AxsInfo
(^a + 1)
;'stack up recursion
EN
,,
_JS
+1
;' as recursion closes, add up stack depths
Executed program from program1.dmc
A Axis: Position: 00029319 Error: 00001312 Torque: 9.9982
B Axis: Position: -00001612 Error: 00000936 Torque: 1.7253
C Axis: Position: 00001696 Error:-00001076 Torque:-1.9834
D Axis: Position: -00002020 Error: 00001156 Torque: 2.1309
E Axis: Position: 00000700 Error:-00001300 Torque:-2.3963
F Axis: Position: 00000156 Error:-00000792 Torque:-1.4599
G Axis: Position: -00002212 Error: 00001732 Torque: 3.1926
H Axis: Position: 00002665 Error:-00001721 Torque:-3.1723
Recursed through 8 stacks
Mathematical and Functional Expressions
Mathematical Operators
For manipulation of data, the DMC-40x0 provides the use of the following mathematical operators:
Operator
Function
Chapter 7 Application Programming
•
149
DMC-40x0 User Manual
Summary of Contents for DMC-4040
Page 54: ...Chapter 3 Connecting Hardware 45 DMC 40x0 User Manual...
Page 55: ...DMC 40x0 User Manual Chapter 3 Connecting Hardware 46...
Page 56: ...Chapter 3 Connecting Hardware 47 DMC 40x0 User Manual...
Page 73: ...Figure 4 1 GalilTools DMC 40x0 User Manual Chapter 4 Software Tools and Communication 64...
Page 185: ...THIS PAGE LEFT BLANK INTENTIONALLY DMC 40x0 User Manual Chapter 7 Application Programming 176...
Page 205: ...THIS PAGE LEFT BLANK INTENTIONALLY DMC 40x0 User Manual Chapter 10 Theory of Operation 196...
Page 222: ...Step 2 Remove ICM s Appendices 213 DMC 40x0 User Manual...
Page 232: ...DMC 4080 Steps 4 and 5 Step 4 Replace ICM s Appendices 223 DMC 40x0 User Manual...