Split Integers

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.
 
How does the data get from the totalizer to the PLC5?
Can you massage the data in the totalizer before it goes into PLC5?
 
The flow computer is an Omni 6000. I can do basic math functions in it on the totalizers and have the ability to select 8 or 9 digits (Rollover at 100,000,000 or 1,000,000,000). I can also select 1, 2, or 3 decimal places so I'm looking at the possibility of using 8 digits and 1 decimal place and stripping the decimal in the Omni (rollover at 10,000,000). If I do this I can have a float with only 7 digits which will not cause the rounding error in my previous post but I'm not sure of the process implications.
 
But how does the data get from the Omni to the PLC5?
Does it use serial communications RS-232/485 and DF1 driver?
Or does it use just a generic ASCII over RS-232 to represent
the data? Is it DH+? Ethernet? What communication protocol?
 
Do a search in the knowledgbase on ABs website under SUPPORT about IEEE floating point numbers in the PLC 5. I suspect that the rounding error is a problem with the IEEE data format (number of significant digits in a fp nubmer).
 
Jiri, the data is coming from the Omni via modbus to a prosoft mvi71-mcm card.

I've ended up doing as I said in my last post; configuring the Omni for 8 digits with a resolution of 'x.x'. I'm going to configure the Omni to divide the total by 10 which will produce a 32 bit totalizer of 7 digits for me to read to the PLC. This way I'm able to massage the float to get what I need without having the floating point register go exponential and round off the value.

grs
 
Bah, still trying. For anyone who's interested, here's the RSLogix 5 program. Note the values captured in the instructions. They represent the problem I'm having now. The totalizer value 9899936 should be split into 989 in N7:30 and 9936 in N7:31 but when converting the float to integer in the divide instruction (first branch rung 3) it rounds the number to 990. Does anyone know a way to truncate the decimal place in a float?
 
Divide by 1000, make your dest. a floating point. Then subtract .5 dest. a floating point. Then move to an integer.
 
Mickey said:
Divide by 1000, make your dest. a floating point. Then subtract .5 dest. a floating point. Then move to an integer.

Bingo! I think I got that about 2 minutes after I posted the question. Thanks Mickey.

Peter, the PLC 5 doesn't have a DDV instruction.

Doug, the omni doesn't provide much in the way of configuring the totalizers. They are what they are, as mentioned before, all I could play with is the # of digits and decimal place.
 

Similar Topics

Hi I have an application need send some position data to Mitsubishi A800 drive via Modbus rtu. I have double integer value in plc. There are two...
Replies
3
Views
2,952
hey all, I am struggling with a problem here and out of ideas on how else to achieve the desired result. I have a monitor inside a machine with...
Replies
0
Views
121
Hello everyone. I have an PLC L35 (fmw 16) with address 192.168.1.1 and too many connected ethernet devices (3 hmi, a lot of ethernet port, asi...
Replies
11
Views
740
Basic question: I don't understand why Network 4 is split over two lines. I want it to appear like for Network 3, i.e. all on one line. Does...
Replies
1
Views
748
Hello I have a project to record temperature from thermocouple and store it to memory card, the problem is my client didn't provide new...
Replies
11
Views
2,948
Back
Top Bottom