grs
Member
- Join Date
- Aug 2003
- Posts
- 202
I'm working on a project where I am changing out an older flow computer with a new one. In doing this I've run into a problem with the flow totalizers in the two flow computers. The old one has a split integer format and the new one provides 32 bit long (dword) integers for the totalizers.
I'm working with a PLC 5 processor and am having trouble trying to convert the 32 bit totalizer into a split integer format (The reason for doing this conversion is to prevent a major rewrite of the program). The 32 bit totalizer contains a value from 0 to 99999999 (no decimals) so what I need to accomplish to mimic the old flow computer would be to have this split into two registers: 9999 in N7:0 (Least significant word) and 9999 in N7:1 (most significant word).
What I've done so far is to use PhilipW's program in http://www.plctalk.net/qanda/showthread.php?t=14672&highlight=double+word and modified it to convert the 32 bit accumulator into a float first. This method works great up to 7 digits but once I have more than that then rounding becomes an issue. For example, if the value 9999999 is placed in F8:0 that is fine, but if 99999999 is placed in F8:0 it rounds it to 1e+08.
Anyone have any ideas? I seem to be at a roadblock here. I don't know if I'm even pursuing the right path for conversion of the values.
I'm working with a PLC 5 processor and am having trouble trying to convert the 32 bit totalizer into a split integer format (The reason for doing this conversion is to prevent a major rewrite of the program). The 32 bit totalizer contains a value from 0 to 99999999 (no decimals) so what I need to accomplish to mimic the old flow computer would be to have this split into two registers: 9999 in N7:0 (Least significant word) and 9999 in N7:1 (most significant word).
What I've done so far is to use PhilipW's program in http://www.plctalk.net/qanda/showthread.php?t=14672&highlight=double+word and modified it to convert the 32 bit accumulator into a float first. This method works great up to 7 digits but once I have more than that then rounding becomes an issue. For example, if the value 9999999 is placed in F8:0 that is fine, but if 99999999 is placed in F8:0 it rounds it to 1e+08.
Anyone have any ideas? I seem to be at a roadblock here. I don't know if I'm even pursuing the right path for conversion of the values.