ETEL Doc. - Operation & Software Manual # DSC2P 903 / Ver. F / 3/6/05 Chapter D: Programming
Operation & Software Manual
Direct Drives & Systems 229
14.6 Float functions
Most registers in the controller (like K parameters, M monitorings, X variables,...) are defined by integer values.
A floating-point value can be handled only by F registers, also called float. 256 F registers (F0 to F255) are
defined (one depth).
14.6.1 Read / write F registers
You may: convert X, K, M, L registers (integers) into an F register (float)
convert an F register (float) into an X or L registers (integers)
Remark: The copy of a F into a X is done by rounding to the closest integer, in the limits of -2
31
to 2
31
.
XAC (accumulator) may also be used, as it is an X register.
Caution: All commands do not accept to handle floating-point and integer values together.
Example: F5.1+=X1.1
is not allowed! Thus, the conversion command (=) should be used every
time when integer and float should be mixed up.
Operations examples Description
F7.2=F4.2 Copies an F register into another F register
F2.1=3.1415f Immediate F value allocation (displayed in floating-point mode)
X3.5=F2.5 Conversion (float > integer) of an F into an X or L
F2.1=X3.1 Conversion (integer > float) of an X, K, L, M into an F
F2.1 Reads an F register (displayed in floating-point mode)
F2.1+=F3.1 Addition between 2 F registers
F2.1-=F3.1 Subtraction between 2 F registers
F2.1*=F3.1 Multiplication between 2 F registers
F2.1/=F3.1 Division between 2 F registers
FSQRT.5=F2.5,F3.5 Square root of an F register (value taken from <P2>, the result is given in <P1>)
FINV.5=F2.5,F3.5 Invert an F register (value taken from <P2>, the result is given in <P1>)
FSIN.5=F2.5,F3.5 Sine of an F register (value taken from <P2>, the result is given in <P1>)
FCOS.5=F2.5,F3.5 Cosine of an F register (value taken from <P2>, the result is given in <P1>)
FSIGN.5=F2.5,F3.5 Reads the sign of an F register in <P2> and writes in <P1> -1., 0. or 1., when the value is <0, =0, or >0
FFP.5=F2.5,F3.5 Reads the fractional part of an F register in <P2> and writes it <P1>
FIP.5=F2.5,F3.5 Reads the integer part of an F register in <P2> and writes it <P1>
FTST.5=F2.5,F3.5 Compares two F registers (similar to the TST command, but for floating-point values)