Mathematical And Functional Expressions - Galil Motion Control DMC-21 5 Series User Manual

Table of Contents

Advertisement

General Program Flow and Timing information
This section will discuss general programming flow and timing information for Galil programming.
WT vs AT and coding deterministic loops
The main difference between
time from the execution of the
from the last time reference set with the
#main;
AT
0;
t=TIME
WT
1000;
t1=TIME-t;t=TIME;
AT
4000;
t2=TIME-t;
MG
t,t2;
EN;
Where the functionality of the operation of the
deterministic loop operating on the controller. These instances range from writing PLC-type scan threads to writing
custom control algorithms. The key to having a deterministic loop time is to have a trippoint that will wait a
specified time independent of the time it took to execute the loop code. In this definition, the
perfect fit.

Mathematical and Functional Expressions

Mathematical Operators
For manipulation of data, the DMC-21x5 provides the use of the following mathematical operators:
Mathematical operations are executed from left to right. Calculations within parentheses have precedence.
speed=7.5*v1/2;
count=count+2;
result=_TPA-(@COS[45]*40);
temp=@IN[1]&@IN[2];
Mathematical Operation Precision and Range
The controller stores non-integers in a fixed point representation (not floating point). Numbers are stored as 4
bytes of integer and 2 bytes of fraction within the range of ±2,147,483,647.9999. The smallest number
representable (and thus the precision) is 1/65536 or approximately 0.000015.
Chapter 7 Application Programming ▫ 96
and
is that
will hold up execution of the next command for the specified
WT
AT
WT
command,
will hold up execution of the next command for the specified time
WT
AT
command.
AT
'label for main program
'set initial AT time reference
'record initial time
'wait 1000 samples
'find time since initial time, record current time
'wait 4000 samples from last time reference
'find time since TIME t
'this should output 1000,3000
'end program
AT
command is very useful is when it is required to have a
OPERATOR
+
Addition
-
Subtraction
*
Multiplication
/
Division
%
Modulo Division
&
Logical And (Bit-wise)
|
Logical Or (Bit-wise)
()
Parenthesis
Table 7.7: List of mathematical operators
'speed equals 7.5 multiplied by v1 and divided by 2
'count equals current count value plus 2
'result equals current A axis position minus 28.28,
cosine of 45deg *40 is 28.28
'temp equals 1 only if Input 1 and Input 2 are high
DESCRIPTION
command is a
AT
DMC-21x5 User Manual 1.0a1

Advertisement

Table of Contents
loading

Table of Contents