Trajexia system
PROGRAMMING MANUAL
27
Revi
si
on 3.0
/i
2.3.4
Mathematical specifications
Number format
The TJ1-MC__ has two main formats for numeric values: single precision
floating point and single precision integer.
The single precision floating point format is internally a 32 bit value. It has an
8 bit exponent field, a sign bit and a 23 bit fraction field with an implicit 1 as
the 24th bit. Floating point numbers have a valid range of ±5.9×10
−
39
to
±3.4×10
38
.
Integers are essentially floating point numbers with a zero exponent. This
implies that the integers are 24 bits wide. The integer range is therefore
given from -16,777,216 to 16,777,215. Numeric values outside this range
will be floating point.
Hexadecimal format
The TJ1-MC__ supports assigning and printing hexadecimal values. A
hexadecimal number is input by prefixing the number with the $ character.
Valid range is from 0x0 to 0xFFFFFF. Example:
>> VR(0)=$FF
>> PRINT VR(0)
255.0000
A value can be printed in hexadecimal by using the
HEX
function. Negative
values result in the 2’s complement hexadecimal value (24-bit). Valid range
is from
−
8,388,608 to 16,777,215. Example:
>> TABLE(0,-10,65536)
>> PRINT HEX(TABLE(0)),HEX(TABLE(1))
FFFFF6 10000
Positioning
For positioning, the TJ1-MC__ will round up if the fractional encoder edge
distance calculated exceeds 0.9. Otherwise the fractional value will be
rounded down. The internal measured position and demanded position of
the axes, represented by the
MPOS
and
DPOS
axis parameters, have 32-bit
counters.
Floating point comparison
The comparison function considers a small difference between values as
equal to avoid unexpected comparison results. Therefore any two values for
which the difference is less than 1.19×10
−
6
are considered equal.
Precedence
The precedence of the operators is given below:
1. Unary minus,
NOT
2. ^
3. / *
4.
MOD
5. + -
6. = <> > >= <= <
7.
AND OR XOR
8. Left to right
The best way to ensure the precedence of various operators is through the
use of parentheses.
'The declaration in start-up program
GLOBAL length, 3
'In other programs executed after the start-up program
start:
length = x
...
...
start:
MOVE(length)
PRINT(length)
...
All mathematical calculations are done in floating point
format. This implies that for calculations of/with larger val-
ues the results may have limited accuracy. The user
should be aware of this when developing the motion con-
trol application.
I52E-EN-03.book Seite 27 Freitag, 29. Juni 2007 11:55 11