BSL and a string of BTDs

stretch_af

Member
Join Date
Mar 2011
Location
Drinking in Wisconsin
Posts
67
So this is a PLC-5 program that was converted to a CLX. Not my creation, but I’m trying to iron out some bugs.

This chain of BTDs are tracking bottles through a filler. The 4th BTD has a Source of B18[3] and a Destination of B18[4]. B18[3].16 appears to have moved into B18[4].0 as it is supposed to, but that is where it stops. The bits stop shifting there, I’m not sure why they stop. The first 3 BTDs work just fine.



Any ideas? Should they be separated onto separate branch rungs? Or arranged differently?

BTD CHAIN.jpg
 
It's not the BTD, but the BSL that's "stopped working".

The BSL length is 128. In a PLC5 N register, that's 8 words. But B18 is formated as a DINT array, so 128 bits is only 4 words.

I don't understand why the BTDs move an extra bit from the end of one register to the beginning of the next. Essentially it's creating a series of " 15-bit words" in the bit array. You still have that, but you've got 17 unused bits as well.

Change B18 to an INT array, and your code should work better.
 
Ahh, that makes sense. Are the BTDs necessary to move move bits around the array? I need to track 108 bits. I suppose I could move bit 31 to the next DINT instead of 16 to fully utilize the DINTs.

I'm still better with PLC5s and SLCs.
 
OK. I see what happened.

Once upon a time, in the PLC5, there was a BSL(B18,128) that worked just fine.

When converted into ControlLogix, the BSL instruction only works on DINT arrays, not INT arrays (which would be compatible with the PLC5 format.

"Someone" -- either the programmer doing the conversion, or the converter program itself -- change B18 from a INT array to a DINT array. Now the BSL worked.

But because there could be lots of references in the PLC5 to B18/64 (aka B18:4/0, aka B18[4].0), rather then reprogramming all those instances, the "someone" used BTDs to move the 16th bit -- which would have gone to the next word if B18 was an INT, but went to a useless position in a DINT.

What "someone" failed to do was to change the 128 to 256 to keep 8 "words" of data.


So you have 2 choices:
(1) Do the easy thing, and change the length of the BSL from 128 to 256, giving you 128 bits in the first 16 bits of each DINT as your track.

(2) Do the right thing and delete the BTDs, then go through the code, and find every reference for B18[1].0 to .15 and change them to B18[0].16 to .31. Then change B18[2].0 to 15 to B18[1].0 to 15 and so forth. Then you'll have a clean DINT array where every bit represents a location, and you can watch things progress down the line.
 

Similar Topics

Hi all, I am trying to convert RSLogix 5000 program to Step7. I need to bit shift left my array of double integers for tracking the product on...
Replies
2
Views
504
I’m working on a conveyor project for work. We’re trying to install a few diverts to carry product directly to one of two trailer doors. I have...
Replies
5
Views
1,004
Hello friends, When I trigger once for an application, I want to shift the 15th bit in the word address by 10 bit , so; 1000 0000 0000 0000 ->...
Replies
3
Views
1,638
Hi everyone, we have a working part rejector already. The issue is the new encoder went from 100ppr to 1024ppr. Hardware is compactlogix...
Replies
4
Views
1,882
Sidenote: One of my favorite lessons back in school was learning about BSL in RSLogix 500, and making it work in a simulator. I've been waiting...
Replies
30
Views
7,967
Back
Top Bottom