Sign in to follow this  
Followers 0
Brentgan

Capturing bits of a dint

3 posts in this topic

So I have a studio 5000 v28 program. There’s about 155 “faults” in 5 dints I want to capture the bits that trigger the most. If it was an array i can do indirect addressing no problems. Not sure easiest way to capture this. Any ideas?

Share this post


Link to post
Share on other sites

You can use a bunch of counters. Use 1 counter for each fault bit. Each time the fault bit = 1, the counter will count up. After a period of time, the counter with greatest ACC value shows which fault bit triggered the most. The downside is, you have to create 155 counters using this method.

Share this post


Link to post
Share on other sites

You can address them indirectly if you want to make an array of counters but there's some math involved. Your counter array will have an index of 0 - whatever. If  you take that index and divide it by 32, you will get the corresponding DINT tag. If you use a MOD instruction you can get the bit within the DINT. Here is a branch of a rung that I use to step through my array of alarms looking for active ones:

AlarmStepThru.PNG.ed35776b1d8e1a84c41a0b

In my case, I have a DINT[4] array for the alarms, which gives me 128 alarms with the highest index being 127. In this screenshot, alarm number 115 is bit 19 in dint 3.

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0