Bit overflow

RayK

Member
Join Date
May 2004
Location
Geraldton West Australia
Posts
90
In our plant there are hour counters logging hours runtime for pumps cyclones etc, my question id when the CTU reaches its bit overflow limit (32000 i think) will this stop the plant as someone here has suggested? Gear is slc500, rslogix and rsview
 
Without seeing the ladder it would be hard to say if you will get a crash, or if the time will reset to 0 when it reaches 32767.

See the picture for one way, when the timer gets DONE, count up or compute +1. Then reset the timer.

This also works for counting (parts run, alarms triggered, alarm hours, hours conveyor run, etc.)

pic 1.jpg
 
Hi Ray,

I'm reasonably sure that the counter overflow will not cause the PLC to shut down. It's easy enough to test for though if you have a test stand. Anyway, if I remember correctly the counter will just carry over to the next value (which is -32768?) and count up until 0.

I highly recommend not using counters for keeping track of motor run time though. The logic is really simple and if you don't require millisecond accuracy is sufficient. Here's how you do it:

1) Program an STI and call it once a minute.
2) Program rungs (1/equipment) as below

Running
----] [------------------ F8:? = F8:? + 0.016667

The value 0.01667 = 1/60 (the number of seconds in a minute) therefore
your results are automatically in hours.

You can fine tune this circuit by calling the STI more frequently and by modifying the constant value appropriatly.

If you use resolution that is too small (ie. call the STI too frequently with a constant that is too small) you'll run into resolution issues with the floating poing varible.

The circuit has at least 2 major benefits.
* It's simple
* It saves lots of memory

Good Luck,

(8{)} ( .)
 
Watch out for overflow

Rayk,
It seems that you are perhaps using the N file for counting. If that is the case then read this.
SLC500 will shutdown if you get a math overflow. i.e.
N file will exceed 32767 limit!
It will cause a major fault and SLC500 processor will fault out and shut down!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
This is not the case with PLC5. PLC5 will roll over into negative and
continue running.
You need to put in a routine that will reset the N file to 0 if overflow is imminent or else at least put in a piece of logic that prevents the count if you have reached 32767.
 
Re: Watch out for overflow

Jiri Toman said:
Rayk,
SLC500 will shutdown if you get a math overflow. i.e.
N file will exceed 32767 limit!

I hate that! If you've got a lot of math in your program it can be tough to find the problem.

I think there is a way to have the PLC handle overflows without stopping. If you catch the problem before the end of the scan, I think you can execute an error handling routine. (Someone check me on that)

AK
 
Here is what AK is referring to - you can unlatch the overflow if you have one.

The option provided by (8{)} ( .) is reasonable too - just remember that the significant digits will change over time, and at some point in the future, adding 0.016667 will have no effect on your float register (I didn't do the math to see if that happens in a week, or in a hundred years - just keep it in the back of your mind).

The other approach that I've used is cascading - ie: when your counter gets to say 10,000, reset it, and increment a second counter. The final count is 10,000 * 2nd_Counter + 1st_Counter.

Marc
 
The option provided by (8{)} ( .) is reasonable too - just remember that the significant digits will change over time, and at some point in the future, adding 0.016667 will have no effect on your float register (I didn't do the math to see if that happens in a week, or in a hundred years - just keep it in the back of your mind).

True and that's why I only call the routine once a minute. If you don't call the routine too often you're safe for at least a decade.


(8{)} ( .)
 

Similar Topics

Right now I`m working on S7-200 PLC and facing few doubts. -How to handle a overflow when performing mathematical function.I am performing...
Replies
0
Views
3,038
I have an HSC counter that is tied to an incremental encoder that keeps running. My PLC is a MicroLogix1100 that is an RSLogix 500 platform. I...
Replies
1
Views
2,750
See the screenshot of EIP tag list. We are trying to read in a digital input that is hard-wired. It is shown here as I31.1. I believe we cannot...
Replies
7
Views
280
A couple days ago I accidentally toggled an alwasyoff bit. The issue is it was set up as a single OTU on a rung, nothing else, and used as XICs...
Replies
3
Views
226
Hi I have an old panel builder 32 that I’m replacing for a factory talk me hmi . In the plc for the old panel builder there is a coms bit for the...
Replies
0
Views
73
Back
Top Bottom