7 Applied Instructions
7.12 Floating Point
504
FXCPU Structured Programming Manual
(Basic & Applied Instruction)
Program example
This is a program for determining COS
-1
of D0, D1 (binary floating decimal point) when the X000 is ON, and
sending the angle to Y040 to Y057 in BCD four digits.
Operation when the value of D0, D1 is 0.5.
[Structured ladder]
X000
VAR_05
*5
DACOS
EN
s
ENO
INT
EN
s
ENO
d
d
D30
*1. VAR_01 is global label, and D0 is defined.
*2. VAR_02 is global label, and D10 is defined.
[ST]
DACOS(X000,VAR_01,VAR_02);
DDEG:=(X000,VAR_03,VAR_04);
INT(X000,VAR_05,D30);
*3. VAR_03 is global label, and D10 is defined.
DDEG
EN
s
ENO
d
VAR_04
*4
D30
BCD
EN
s
ENO
d
K4Y40
VAR_01
*1
VAR_02
*2
VAR_03
*3
*4. VAR_04 is global label, and D20 is defined.
*5. VAR_05 is global label, and D20 is defined.
BCD(X000,D30,K4Y10);
Calculation of angle (radian) by
COS
-1
operation. (1))
Conversion of radian into angle. (2))
Conversion of angle of binary floating
decimal point (real number) into integer (BIN). (3))
Output of angle converted to
integer to display unit. (4))
Value of binary floating
decimal point (real number)
0.5
D1 D0
1) COS
-1
conversion
Value of binary floating
decimal point (real number)
1.047198
D11 D10
DACOS
Value of binary floating
decimal point (real number)
60
D21 D20
3) BIN
conversion
60
b15 b0
D30
BIN value
4) BCD
operation
BCD
0 0 6 0
Y057 Y040
BCD value
DDEG
2) Angle conversion
INT