MrPLC.com - Programming Application - How to use Bit Shifts...
IPB
PLC Articles, Whitepapers and Applications

 

Home | Forums | Articles | Store | Download Code | Links | Contact Us
 
MrPLC Articles



Main > Allen Bradley > Applications

Minimize Text   Default    Enlarge Text

Programming Application - How to use Bit Shifts (BSL) in PLCs

I've been asked many times enough through e-mails, forum questions on how to use a bit shift. I use bit shifts in just about every program I write for an automated machine company. Bits shifts are used in anything from an index table, to a machine that has a walking beam, or even a servo controlled conveyor. What do you use bit shifts for? They can be used for tracking the individual status of multi-product on a fixed mechanical motion device. That's my definition that I am going to try and explain. I only try and use bit shifts when my product or part is confined in a space mechanically locked down. Then you can assign some meaningful way of tracking the part status as it moves through your machine. The most common method is a good or bad part sorter at the end of your machine.

 

You can download the animated bit shift GIF file here and follow along if you like.

http://forums.mrplc.com/index.php?autocom=downloads&showfile=350 

 

Everyone is entitled to an opinion, so I am going to explain to you my theory of how I apply a bit shift. In my example below, let's assume I have a servo controlled conveyor that indexes. Each bottle is separated one behind the other, and I need to make sure a bottle is in position on my conveyor "carrier pallet", fill the bottle, apply a label, and vision inspect the label on the bottle. If all those condition pass, finally place a cap on the bottle, then send it down stream for packaging. If my bottle doesn't have a label or failed the vision test, then I want to reject the bottle down a reject trap door. I also do not want to waste a cap if the label is wrong or missing.

 

 

In my application, I choose to use two bit shifts at the same time. One bit shift "means" bottle is present. So the whole time, regardless if the bottle has a label, filled or not filled, I just want to know that a bottle is in the servo controlled conveyor belt carrier. If a bottle is not in the carrier, then I do not want to fill up that space with liquid when the empty carrier passes under the bottle filler. At the same token, I use the second bit shift to track a good bottle or bad bottle status. This is primarily used for the reject chute at the end of the process. The logic of the reject chute will be, if bit shift B3:0/7 is equal = 1, which means bottle present, but bit shift B3:1/7 is equal = 0, which means bad bottle, then run the reject chute. If B3:0/7 = 1 and B3:1/7 = 1, then do not run the reject chute because the bottle is good. However if B3:0/7 = 0 and B3:1/7 = 0, then do not run the reject chute either because there is no bottle present in the carrier.

 

So there is no need to place a photoeye at each station when using two bit shifts. Granted, there maybe times when you still need a photoeye at some stations, like if you need to make sure your part dropped down the bad part chute using a bad part chute verify photoeye. Since an index table or other mechanically fixed device can contain the part mechanically, then save some money and place only one photoeye in the beginning of the process to track the status of the part through the machine.

 

A couple of other rules I'd like to point out with my theory of bit shifts. These are my personal preferences. Most of the time I rarely have any more than 15 stations or operations on a part that need assembled or work. So that makes a bit shift an ideal setup for dedicating one whole word to a tracking process. Since I am going to use the whole word anyway, then I also try and correlate bits to station numbers.

 

Word file = B3:0 means: Tracking the bottles for part present

Word file = B3:1 means: Tracking the status of the bottle good or bad.

 

Bit level, B3:0/1 means, is there a bottle at station #1? 1 = yes, 0 = no.

Bit level, B3:1/1 means, is the bottle at station #1 good or bad? 1 = good, 0 = no.

 

Each bit number means which station to me. Bit 1 = station #1, Bit 7 = station #7. This helps me remember when I have multi-bit shifts, which bits do I need to track certain processes and at which stations. I've had as many as five bit shifts to track a single part through a machine. What this also does for me is I never use B3:0/0 or B3:1/0 in this application case.

 

Rule number two for me and my bit shift theory is I latch my bit shift bits with an OTL command and unlatch bits in the shift register with OTU commands. I never actually "load" the bit shift up like most people would do. I've seen programming examples where people try and program the "BIT ADDRESS:" field of a BSL instruction to be the loading bit in the bit shift register. I am going to tell you right now in my example here in this article that is NOT how I do this. I set my bits in the shift registers, manually for each station. There will be a time in my life when I will need to load the bit shift from the "BIT ADDRESS" field of the BSL, but for now, I am going to show you a different way.


Page 1 of 4
Next








Home | Enter Forums | Articles | Visit the Store | Download Code | Automation Links | Contact Us
Terms of Use
| Privacy Policy
Copyright 2001 MrPLC.com an Elston Systems, Inc. owned web property.