This program will accept a string input of up to 6 characters, parse each character, and then display each character.
Notice also that the values used for masking are represented in hexadecimal (as denoted by the preceding ‘$’). For
more information, see section Sending Messages.
To illustrate further, if the user types in the string “TESTME” at the input prompt, the controller will respond with
the following:
T
Response from command MG len6 {S4}
E
Response from command MG len5 {S4}
S
Response from command MG len4 {S4}
T
Response from command MG len3 {S4}
M
Response from command MG len2 {S4}
E
Response from command MG len1 {S4}
Functions
FUNCTION
DESCRIPTION
@SIN[n]
Sine of n (n in degrees, with range of -32768 to 32767 and 16-bit fractional resolution)
@COS[n]
Cosine of n (n in degrees, with range of -32768 to 32767 and 16-bit fractional resolution)
@TAN[n]
Tangent of n (n in degrees, with range of -32768 to 32767 and 16-bit fractional resolution)
@ASIN*[n]
Arc Sine of n, between -90
°
and +90
°
. Angle resolution in 1/64000 degrees.
@ACOS*[n]
Arc Cosine of n, between 0 and 180
°
. Angle resolution in 1/64000 degrees.
@ATAN*[n]
Arc Tangent of n, between -90
°
and +90
°
. Angle resolution in 1/64000 degrees
@COM[n]
1’s Complement of n
@ABS[n]
Absolute value of n
@FRAC[n]
Fraction portion of n
@INT[n]
Integer portion of n
@RND[n]
Round of n (Rounds up if the fractional part of n is .5 or greater)
@SQR[n]
Square root of n (Accuracy is +/-.004)
@IN[n]
Return digital input at general input n (where n starts at 1)
@OUT[n]
Return digital output at general output n (where n starts at 1)
@AN[n]
Return analog input at general analog in n (where n starts at 1)
*Note that these functions are multi-valued. An application program may be used to find the correct band.
Functions may be combined with mathematical expressions. The order of execution of mathematical expressions is
from left to right and can be over-ridden by using parentheses.
Examples:
v1=@ABS[V7]
The variable, v1, is equal to the absolute value of variable v7.
v2=5*@SIN[pos]
The variable, v2, is equal to five times the sine of the variable, pos.
v3=@IN[1]
The variable, v3, is equal to the digital value of input 1.
v4=2*(5+@AN[5])
The variable, v4, is equal to the value of analog input 5 plus 5, then
multiplied by 2.
Variables
For applications that require a parameter that is variable, the DMC-40x0 provides 510 variables. These variables
can be numbers or strings. A program can be written in which certain parameters, such as position or speed, are
defined as variables. The variables can later be assigned by the operator or determined by program calculations.
For example, a cut-to-length application may require that a cut length be variable.
Chapter 7 Application Programming
•
151
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...