#LOOP
Simple program loop
JP#LOOP
EN
#TCPERR
Ethernet communication error auto routine
MG {P1}_IA4
Send message to serial port indicating
which handle did not receive proper
acknowledgment.
RE
JS Subroutine Stack Variables (^a, ^b, ^c, ^d, ^e, ^f, ^g, ^h)
There are 8 variables that may be passed on the subroutine stack when using the JS command. Passing values on the
stack is advanced DMC programming, and is recommended for experienced DMC programmers familiar with the
concept of passing arguments by value and by reference.
Notes:
1. Passing parameters has no type checking, so it is important to exercise good programming style when
passing parameters. See examples below for recommended syntax.
2. Do not use spaces in expressions containing ^.
3. Global variables MUST be assigned prior to any use in subroutines where variables are passed by
reference.
Example: A Simple Adding Function
#Add
JS
#SUM
(1,2,3,4,5,6,7,8)
;' call subroutine, pass values
MG
_JS
;' print return value
EN
'
#SUM
;NO(^a,^b,^c,^d,^e,^f,^g,^h) syntax note for use
EN
,,(^a+^b+^c+^d+^e+^f+^g+^h)
;' return sum
:Executed program from program1.dmc
36.0000
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
Chapter 7 Application Programming
•
147
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...