Bit Shift / Indexed Addressing

zblum

Member
Join Date
Mar 2016
Location
Ohio
Posts
38
I am trying to use indexed addressing to store a long series of bits in a "file" via a bit shift left function in RSLogix 500. The file I want to use is #B3:1. I will be passing many values, so obviously this will grow to B4, B5, etc. (I set a maximum file length of 2000).
My question is, how do you reference a bit in this file? Each bit passed in the function is analogous to a physical location, of which there are three that I want to monitor regularly (e.g. There are three air nozzles on a conveyor line. The first is located 25inches down the conveyor. A bit is stored every 0.25" using an encoder. So I would then want to monitor the 100th bit in this "file").
It doesn't seem super complicated in theory, however, I cannot quite wrap my head around it.
Also, does anyone know if this can be used with a MicroLogix 1200?
Thanks
 
To address a bit position in a file would be B3:1[x] where x is 0 to 15...that's at the bit level of a word. If you want it at the bit level of the entire file it would be B3/[x] where x could be 0 to 31999 (on a 2000 word length).

You will not be able to span files however....In otherwords, B3/[2000] is not equivalent to B4/0.
 
Your Binary files will not automatically "grow" from B3 to B4 to B5 etc.

File number 4 will be a Timer file, T4, so you can't have a B4....

Sounds like you want to create a large bit array...

Basic Fact : One "data-file" cannot be more than 256 "elements" in size.

So, you can only create (for example), an integer file N100:0 to N100:255 (that's 256 "elements"), a Timer file T27:0 to T27:255 (also 256 "elements").

Binary Files break the rule..... An "element" of a binary file isn't a single bit, it is a word of memory. Think of a Binary File as "chunks" of 16-bits. so 1 "element" becomes 1 memory word, holding 16 bits.

So the maximum file size for a Binary file is 256 elements (that's the "file-size" rule), and that equates to 256x16 bits = 4096 bits.

So : a Binary File of 256 length allows 4096 bits, I think that fits with what you want 2000 bits....

You would address any single bit in the file as Bxx/yyyy, where xx is the file number, and yyyy is the bit number.

Here's a couple of addressing examples, working with Binary file B100

B100/267 : bit 267 in the binary file

B100/[N7:55] : if N7:55 = 3001, bit 3001 in the binary file.

The processor will "Major Fault" if the indirect address N7:55 equates to a number outside of the addressed binary file.

FYI, it is possible to have larger data "arrays" than the 256 element rule allows for... It involves creating consecutive data files, and suppressing the processors file boundary tests... not for the faint-hearted, but sometimes necessary.
 
The processor will "Major Fault" if the indirect address N7:55 equates to a number outside of the addressed binary file.
For this reason it is very strongly advised that some sort of validation be done on the indirect (N7:55 in this case) part of the address.
 
4096 bits, I think that fits with what you want 2000 bits....

You would address any single bit in the file as Bxx/yyyy, where xx is the file number, and yyyy is the bit number.

Here's a couple of addressing examples, working with Binary file B100

B100/267 : bit 267 in the binary file

Thank you for the addressing help. Using the RSLogix500 software, I just set the file address to B1 (which automatically displays as #B9:0, with B9 being the 125 element data file I created specifically for this data --> 125x16=2000). By setting the "Length" parameter inside the RSLogix500 BSL function to "2000", it works just as I wanted.
 
Could 2 Bit shifts be used? The second one addressed to the final bit of the first bit shift. both fired at the same time. Essentially running the two in series. As soon as the first one is maxed out it will automatically overflow into the second?
 
It is possible to address across files if you turn of the s:flag allowing it.
You can create a series of files of the same type and address across the whole lot. I don't recommend going outside of your memory space. So validation is necessary.

I don't know if you can do it with the indirection addressing but it is definitely available if you use the dedicated indirect addressing register s:24.
 
It is possible to address across files if you turn of the s:flag allowing it.
You can create a series of files of the same type and address across the whole lot. I don't recommend going outside of your memory space. So validation is necessary.

I don't know if you can do it with the indirection addressing but it is definitely available if you use the dedicated indirect addressing register s:24.

I am actually looking at this possibility now, but can't seem to find a way to get a BSL or BSR to accept a larger bit-file size than a single data-file, of 256 elements (4096 bits).

In fact, the Length parameter of BSL/BSR is limited to 2048, which is only half of what I would suspect should be allowed.... hmmm

Nevertheless, bit-shifting multiple, cascaded, bit-files is a possibility, and with careful configuration, ought to be successful.

Addressing bits in the "extended" area would need the "Index Across Data Files" S:2/3 to be set, but, as that is normally a safeguard against bad coding, it is refreshing that it is a writable bit, so can be turned ON and OFF as and when required.

An exercise only, zblum only needed 2000 bits, so it fitted in one Bit-Shift file....
 
Last edited:

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,693
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
741
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,943
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,642
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,450
Back
Top Bottom