EasyManua.ls Logo

Galil Motion Control DMC-4123 - Example: Variable, and an Important Note about Creating Global Variables; Example: Working with Arrays; Example: Abstracting Axes

Galil Motion Control DMC-4123
237 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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-41x3 User Manual

Table of Contents

Related product manuals