Rounding errors micrologix

khewes

Member
Join Date
May 2016
Location
New Hampshire
Posts
123
hello all,
I cannot seem to surpass this rounding issue i am having. every time a counter gets to 30 seconds, it rounds to 1 minute. i was wondering if there could be anyway to bypass this without math. for example by just changing a setting or something of that sort? any input would be much appreciated, thank you.

I am using rsemulation and rs logix micro starter pro
 
You are leaving something out, there has to be some math already to get from a value
representing seconds to a value representing minutes.

To stop the results from rounding use a floating point register instead of an integer as the destination of your math to converter to minutes. This would give you 30/60= .5 min. Is this what you want? Or please tell us what results you would like to see.
 
You are leaving something out, there has to be some math already to get from a value
representing seconds to a value representing minutes.

To stop the results from rounding use a floating point register instead of an integer as the destination of your math to converter to minutes. This would give you 30/60= .5 min. Is this what you want? Or please tell us what results you would like to see.


So i have my timer preset - timer acc. = seconds left (integer).

I then divide this integer by 60 to get total minutes left(integer).
If i start with 900 seconds as a preset, i will see 15 total minutes left.
I expect this integer to decrease every 60 seconds, but it decreases first at 30 seconds, and then every 60 seconds. soo this offset of thirty seconds makes my total time left off by 30 seconds, which could possibly be a crucial amount of time for what i am programming my plc to do....which is heat treat some different plastic products...ill attach my code, and you can see where i play with it at the very bottom in rung 100. it is a mess right now because i am desperately trying everything i can think of
 
You are leaving something out, there has to be some math already to get from a value
representing seconds to a value representing minutes.

To stop the results from rounding use a floating point register instead of an integer as the destination of your math to converter to minutes. This would give you 30/60= .5 min. Is this what you want? Or please tell us what results you would like to see.

i guess i dont know what a floating point register would be in micrologix...would it be a data file?

I actually do not think it is included in my free software for the micrologix 1000....it would be an f8 right? i only have up to n7
 
You are right, your ML1000 does not support floating point data types.

I am completely lost at what you are trying to accomplish. What part of your program is controlling a heating process?

Guessing...
Why are you trying to convert to minutes for control? Just use the timers second's value to control your heating process.
 
I am completely lost at what you are trying to accomplish. What part of your program is controlling a heating process?

Guessing...
Why are you trying to convert to minutes for control? Just use the timers second's value to control your heating process.

Im trying to convert to minutes for user friendly control. no user wants to look at seconds when watching a timer itd be absurd...

and as far as what im trying to accomplish, im setting u an hmi interface with a cincinatti subzero temperature treater...thingy...lol. I am only an intern, so my input is limited. Ive been trying to tell my mentor that it would be much simpler to tie in a temp sensor and preprogram the cycle times and what not...but he said to worry about all that bs after.


are there any ways to create a float using integers?
 
Im trying to convert to minutes for user friendly control. no user wants to look at seconds when watching a timer itd be absurd.

I disagree.

But there is a difference between what an operator sees on a HMI screen and what is under the hood doing the actual control.
 

Similar Topics

I just kind of wanted to propose a general discussion. I've recently implemented a program in an Allen Bradley PLC. One of the lines of code used...
Replies
1
Views
1,881
Hi all, I'm connecting several 4-20mA sensors together in parallel (only one shown below) The enclosure is ABS plastic with metal backplate DAQ...
Replies
5
Views
273
I have Rhino 120 to 24 dc power supply and it has 2 Positive and 2 negative terminals on the DC side but no ground terminal. Should I connect one...
Replies
9
Views
434
Hi, Our customer has bought a machine a CNC wood cutting machine. It states that it need a seperate 16mm2 EMV"ground" in addition to our 5G16mm2...
Replies
2
Views
602
I have a Beckhoff PLC with many AI modules. Most devices are loop powered using the same +24 VDC power as the Beckhoff Bus Coupler and all is...
Replies
5
Views
668
Back
Top Bottom