Galil DMC-1700 Home Security System User Manual


 
DMC-1700/1800 Chapter 7 Application Programming • 155
@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-1700/1800 provides 254 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.
Example:
PR POSX Assigns variable POSX to PR command
JG RPMY*70 Assigns variable RPMY multiplied by 70 to JG command.
Programmable Variables
The DMC-1700/1800 allows the user to create up to 254 variables. Each variable is defined by a name which can be
up to eight characters. The name must start with an alphabetic character, however, numbers are permitted in the rest
of the name. Spaces are not permitted. Variable names should not be the same as DMC-1700/1800 instructions.
For example, PR is not a good choice for a variable name.
Examples of valid and invalid variable names are:
Valid Variable Names
POSX
POS1
SPEEDZ
Invalid Variable Names
REALLONGNAME ; Cannot have more than 8 characters
123 ; Cannot begin variable name with a number
SPEED Z ; Cannot have spaces in the name
Assigning Values to Variables:
Assigned values can be numbers, internal variables and keywords, functions, controller parameters and strings;
The range for numeric variable values is 4 bytes of integer (2
31
)followed by two bytes of fraction