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,369
Hi Everyone, I am facing an issue while installing the STUDIO 5000 in my windows 10 PC. During installation I am getting an error that " Error...
Replies
1
Views
26
I am connecting to a remote device. When attempting to upload I receive an error that states: Error: Auto_Functions: The Import was aborted due...
Replies
3
Views
134
Hi all. Never really noticed, but I started double checking operands in the CPT instruction. I found if I have the expression N7[37,1] - N7[35,1]...
Replies
3
Views
107
Back
Top Bottom