Example: Variable, and an Important Note about Creating Global Variables
#Var
value=5
;'a value to be passed by reference
global=8
;'a global variable
JS
#SUM
(&value,1,2,3,4,5,6,7)
;'note first arg passed by reference
MG
value
;'message out value after subroutine.
MG
_JS
;'message out returned value
EN
'
#SUM
;NO(* ^a,^b,^c,^d,^e,^f,^g)
^a=^b+^c+^d+^e+^f+^g+^h+global
EN
,,^a
'notes:
'do not use spaces when working with ^
'If using global variables, they MUST be created before the subroutine is run
Executed program from program2.dmc
36.0000
36.0000
Example: Working with Arrays
#Array
DM
speeds[8]
DM
other[256]
JS
#zeroAry
(
"speeds"
,0)
;'zero out all buckets in speeds[]
JS
#zeroAry
(
"other"
,0)
;'zero out all buckers in other[]
EN
'
#zeroAry
;NO(array ^a, ^b) zeros array starting at index ^b
^a[^b]=0
^b=^b+1
JP
#zeroAry
,(^b<^a[-1])
;'[-1] returns the length of an array
EN
Example: Abstracting Axes
#Axes
JS
#runMove
(0,10000,1000,100000,100000)
MG
"Position:"
,
_JS
EN
'
#runMove
;NO(axis ^a, PR ^b, SP ^c, AC ^d, DC ^e) Profile movement for axis
~a=^a
;'~a is global, so use carefully in subroutines
'try one variable axis a-h for each thread A-H
PR
~a=^b
SP
~a=^c
AC
~a=^d
DC
~a=^e
BG
~a
MC
~a
EN
,,
_TP
~a
Chapter 7 Application Programming ▫ 118
DMC-42x0 User Manual
Содержание DMC-42 0 Series
Страница 85: ...Chapter 6 Programming Motion 81 DMC 42x0 User Manual Figure 6 14 ECAM cycle with Z axis as master...
Страница 195: ...ICM 2900 PCB Layout Appendices 191 DMC 42x0 User Manual...
Страница 205: ...CB 50 100 Drawings Appendices 201 DMC 42x0 User Manual...
Страница 206: ...Appendices 202 DMC 42x0 User Manual...
Страница 207: ...Appendices 203 DMC 42x0 User Manual...
Страница 208: ...Appendices 204 DMC 42x0 User Manual...
Страница 209: ...Appendices 205 DMC 42x0 User Manual...
Страница 210: ...Appendices 206 DMC 42x0 User Manual...
Страница 211: ...Appendices 207 DMC 42x0 User Manual...
Страница 214: ...CB 50 80 Drawing Appendices 210 DMC 42x0 User Manual...
Страница 215: ...Appendices 211 DMC 42x0 User Manual...