Bit shift only high bits

PFrog

Member
Join Date
Apr 2011
Location
Ohio
Posts
83
Hello,

I am creating some local messages of faults in View Studio ME. I would like to setup the compactlogix processor to only rotate through the high bits of active faults. I can do this in ladder or ST, although I am not too familiar with ST. So ideally I would like a message to display for a few seconds, and then load the next active bit into the local message display.

Any ideas?

Thanks
 
Yes, just increment a pointer to point at each bit. If the bit is high, set the alarm message for that bit and hold for as long as you want to display, then go back to incrementing the pointer until you find the next high bit, and so on.
 
Look at the FBC instruction. It can create a table with the bit number of each bit that is set in a DINT array.

Once that table has been created, you can use a pulsing timer to increment a pointer/mover to read the each bit number in turn.

The bit number would then be the local message number in ME.
 
What would be a good way of indexing at the bit level? I have a MSG_SYSTEM_FAILURE DINT that currently is tied to my local messages. I'm having issues setting up the code to index this.
 
If you use the FBC, you will need a reference file, a place to store the result, two control structures and you will want to set the IN bit of the Cmp. Control so that you find one mismatch at a time. I think you will want to trigger the FBC instruction with a timer that represents the refresh interval of the displayed result.

The reference file will just be a file that stores the bit pattern you want to compare against. If your alarm conditions are represented by "1" in each of the bits you search through, and the reference file has "0" in those bit locations, the FD bit will get set and the POS value in the Result control structure will be the value of that bit location within the array of bits and can be mapped to the HMI alarm banner.

If you have a situation where you want alarms to be silenced, then you can set those bit positions in the reference file to match those positions in the alarm file so that the FBC will not find a mismatch at those locations.

It takes a bit of work to get it set up properly, but it will work for what you want to do.

Me, I just use Red Lion HMI Alarm banner on a master slide and it does all this for me automagically.
 
Last edited:
What would be a good way of indexing at the bit level?

If I'm understanding you, you have a DINT array (say MyArray[10]), and you want to examine / set bit number, say 100, in that array (i.e., bit MyArray[4].4).

Or rather, you want a generic solution for bit "MyIndex", preferably one that doesn't involve MOD 32 math and so on.

The reference would be:
MyArray[(MyIndex AND NOT 31) / 32].[MyIndex AND 31]

Yes, you can do all this math as part of the address reference in an XIC/XIO or OTE/OTL/OTU instruction.

Is this what you're looking for?
(This in the RSLogix5000 help file -- search for "Specify Bits in Arrays" for INT and SINT examples)
 

Similar Topics

Hi All. I have a very specific question about tracking using an encoder and bitshift register. We would like to use a Compact or Control Logix PLC...
Replies
40
Views
1,723
Hello. I've been using the answers in this forum for a while now, so thank you. Usually I can find the answer I'm looking for with a basic...
Replies
8
Views
753
Hi, I need some help write a PLC instruction. I am using Proficy Machine Edition 6.5. Our indexing rotating table has 3 nests that are equally...
Replies
15
Views
3,971
Good morning (EST), I am trying to implement the code below in on an S7-1200. It's barely half a dozen instructions, but I am stuck; I have not...
Replies
26
Views
5,657
I have a program I need to work out for a client and I'm having trouble figuring out the correct logic to do it. Let me see if I can explain it...
Replies
27
Views
6,494
Back
Top Bottom