If the PLC5/40 has the MOD instruction, then you can...
MOD the floating point number with 1, to reveal only the fractional part, destination a temporary f.p. data-table location.
MUL the fractional part by 10,000, to destination INT2
SUB the fractional part from the original f.p. number, to destination INT1
Note that you will only be able to get max 4 significant digits from either XXX or YYY, because an INT can only hold up to 32,767. That is why I have multiplied the fractional part by 10,000.
example :
Original number = 3.141593 (pi)
MOD 3.141593, 1 = 0.141593
MUL 0.141593, 10000 = 1415.93, but stored into an INT, it will be rounded to 1416
SUB 3.141593, 0.141593 = 3.0, but stored to an INT, rounded to 3
Now that worked OK for pi, and we could have asked for 5 significant digits, but another example proves we can only go to 4....
Original number = 2.718282 (e)
MOD 2.718282, 1 = 0.718282
MUL 0.718282, 10000 = 7182.82, but stored into an INT, it will be rounded to 7183
SUB 2.718282, 0.718282 = 2.0, but stored to an INT, rounded to 2
If we had tried to get 5 sig. digits, the MUL would have resulted in 71828.2, which cant be store in an INT location.
For similar reasons, the highest floating point number we could use this method on would be 32767.xxxx
There is another way, but again it depends if the PLC5/40 has the Truncate (TRN) instruction. This will store in the destination only the whole number part of the f.p. value.
example:
Original number = 3.141593 (pi)
TRN 3.141593 = 3.0, stored to an INT =3
SUB 3.141593, 3 = 0.141593
MUL 0.141593, 10000 = 1415.93, but stored into an INT, it will be rounded to 1416
If neither of those instructions are available, the brute force method is bound to work, but less efficient, and you will need to be careful what floating point number you throw at it (remember it must not be higher than 32767.yyyy) ...
Make the Original number positive (but remember if it was negative).
LES Original, ,0 OTE Neg_flag (a new flag).
ABS Original, Original
or,
XIC Neg_flag : NEG Original
or,
XIC Neg_flag : MUL Original, -1, Original
Copy the new positive original number to a temporary location. I'll call it Temp.
LBL1 : GEQ Temp, 10000 : SUB 10000, Temp : JMP LBL1
LBL2 : GEQ Temp, 1000 : SUB 1000, Temp : JMP LBL2
LBL3 : GEQ Temp, 100 : SUB 100, Temp : JMP LBL3
LBL4 : GEQ Temp, 10 : SUB 10, Temp : JMP LBL4
LBL5 : GEQ Temp, 1 : SUB 1, Temp : JMP LBL5
Temp now holds 0.yyy
Restore the sign of the Original Number
XIC Neg_flag : NEG Original
or,
XIC Neg_flag : MUL Original, -1, Original
INT1 = Original number - Temp
INT2 = Temp * 10000
Lots of ways to do it, at least one of them should work, but remember to LIM the original number because of the INT storage limitations.