Hi,
The following code had been running for 10+ years on a 928A ....
L DW1
L DW2
-F [HIGHLIGHT]DW1 - DW2 as a 16-bit integer[/HIGHLIGHT]
FDG [HIGHLIGHT]Convert to floating point.[/HIGHLIGHT]
Note that this used to work ok even when the result was negative.
The CPU was replaced with a 928B and the above code no longer worked. The result of the -F was correctly calculated, with sign, but the sign was lost during the FDG. It appears that FDG converts a 32-bit number to a floating point, and if the sign from the -F was bit 15, this becomes just a part of the number in a 32 bit int. It is not treated as the sign bit, and hence the conversion to float doesn't work correctly.
A call to OB220 (Sign Extend) fixed the problem. However, I cannot fathom how the code ran ok on the 928A. There is a document on the Siemens site about pre-1997 928Bs having a problem with 1-L and 1-H when doing -F, +F, *F but nothing to explain how this might work with a 928. I don't have the firmware versions of either the original or the replacement CPU.
Can anyone cast any light on this please?
Thanks,
M
The following code had been running for 10+ years on a 928A ....
L DW1
L DW2
-F [HIGHLIGHT]DW1 - DW2 as a 16-bit integer[/HIGHLIGHT]
FDG [HIGHLIGHT]Convert to floating point.[/HIGHLIGHT]
Note that this used to work ok even when the result was negative.
The CPU was replaced with a 928B and the above code no longer worked. The result of the -F was correctly calculated, with sign, but the sign was lost during the FDG. It appears that FDG converts a 32-bit number to a floating point, and if the sign from the -F was bit 15, this becomes just a part of the number in a 32 bit int. It is not treated as the sign bit, and hence the conversion to float doesn't work correctly.
A call to OB220 (Sign Extend) fixed the problem. However, I cannot fathom how the code ran ok on the 928A. There is a document on the Siemens site about pre-1997 928Bs having a problem with 1-L and 1-H when doing -F, +F, *F but nothing to explain how this might work with a 928. I don't have the firmware versions of either the original or the replacement CPU.
Can anyone cast any light on this please?
Thanks,
M
Last edited: