RSLx 5000 comparing bool array

DairyBoy

Member
Join Date
Jun 2007
Location
UK
Posts
393
Hello all. I'm looking for a direct (single instruction) way to check a 128 bit bool array for non-zero status. Is this possible? Thanks.

Edit: Daba, I have looked at your solution (and others) in another thread but as that one was about comparing two bools, I was hoping that cmp>0 may be more straightforward.
 
Last edited:
Since your searching an array as opposed to using an DINT to store the bools a compare command only is used on Ints, dint, reals. You can use FSC, file search and compare, command to search for an non zero element of an array. This command compares each element in the array so worst case time scenario is that all Bool are 0. Of course you can make your own compare instruction in logic
 
Thanks Darkzadow, it looks like the right thing for the job but having tried various expressions (and looked at the online help), I can't get it error-free. Can I use the expression "bool_array>0" or is that too simple? Should the length be "1" for one array or "4" for 4 x 32 bits? Can I use the .DN bit to reset the .IN bit so that it cycles continuously and follows the expression all the time? I'm a bit lost.
 
While it's probably not even close to any "elegant" way of doing it (and assuming you are using RSLogix5000) you could use the "FOR" function, test each value separately, and then use a counter to capture the results.

Junk Code.jpg Junk Routine.jpg
 
Thanks Steve & Peter. I think 5000 is just too complex for some applications. 500 has many neat tricks that seem to need reinventing in 5000 but customers look twice if the "old" model is suggested these days. :cry:
 

Similar Topics

Hi all. I went to a site today that has AB processors/HMIs on an ethernet network. They're not all mapped to each other and I needed to add one of...
Replies
15
Views
3,348
Hi, how do I convert 2x Integer registers to a Real? The two integers are from Modbus registers that contain a floating point value, I need to...
Replies
2
Views
85
What is the best way to extract the hour and minute from the register that comes from Yaskawa VFD. In studio 5000 I have a register saved as INT...
Replies
3
Views
94
I have an Allen Bradley temperature switch that I am trying to use in studio 5000. I am getting the message "Unable to interpret the IODD file"...
Replies
0
Views
60
Hi all. I want to ask what may seem a stupid question, as I have a project to send live data to a Yeacode line printer which will print meterage...
Replies
8
Views
153
Back
Top Bottom