EasyManua.ls Logo

Galil DMC-4040 - Page 157

Galil DMC-4040
284 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...
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
Example: Local Scope
#Local
JS#POWER(2,2)
MG_JS
JS#POWER(2,16)
MG_JS
JS#POWER(2,-8)
MG_JS
'
#POWER ;NO(base ^a,exponent^b) Returns base^exponent power. +/- integer only
^c=1 ;'unpassed variable space (^c-^h) can be used as local scope variables
IF ^b=0 ;'special case, exponent = 0
EN,,1
ENDIF
IF ^b<0 ;'special case, exponent < 0, invert result
^d=1
^b=@ABS[^b]
ELSE
^d=0
DMC-40x0 User Manual Chapter 7 Application Programming 148

Table of Contents

Related product manuals