BitShifting

gbradley

Lifetime Supporting Member
Join Date
Apr 2002
Location
Corona, Ca.
Posts
1,637
I built a part sorting machine that uses a rotary table.
The first station measures the part and then based on the value it is dumped in one of four bins.
I used the Bit Shift to keep track of the Bins.

The ladder has basically three parts:
1. detect an input and latch a register bit.

2. bit shift all register bits one place.

3. output to the appropriate Solenoids based on the shifted value.

This is working well, but I was hoping for some criticism on my method.

Thanks George Bradley

sort1.jpg
 
You get no criticism from me, George. That's how I'd do it!... (y)

Not that there aren't other methods though!... ;)

beerchug

-Eric
 
Thanks Eric
This is how I fire the outputs.
It seems like there should be a cleaner way to do it. Fewer rungs???

sort2.jpg
 
You want your program to be easily understood by someone other than you, so write it in the most straightforward way, even if it means 'extra' rungs...

On your second post, you could save a contact or two by using an internal bit to monitor the two timers like this:

| T4:1 T4:0 INTERNAL
|---] [------]/[-------------( )
| TT TT


.
Then use this INTERNAL wherever you presently AND the timer bits

But there's really no need... :rolleyes:

beerchug

-Eric

OK Phil, what did you go and do now?... :confused:

IOW, what's with the double-spacing when using the [ladder] tag?... šŸ™ƒ
 
You could branch your outputs as shown below if you want. Sometimes this clears thing up if they are related as you situation seems to be:

ladder branch.jpg
 
Thanks!
I like the way that looks Norm.
I got the machine working, and I'm just cleaning up the documentation.
I work with some of the Smartest people I have ever met. Miles ahead of me, but when I ask for PLC advice, I get blank stares.
This Site Rocks!
 
Suggestion

When tracking product through a machine, rather than use a 'bit', I assign a word to each product. The advantage of this is that a product's status can 'develop' as it progresses.
At the first station it is assigned a 1 (bit 0), second station a 2 (bit 1), third station a 4 (bit 2). This way it is easy to see what the product is missing at the end of the machine if you have a reject system.
I also tend to keep the data static and shift indirect address pointers instead.

Paul
 
One thing to keep in mind as a less expensive (scan time wise, memory usage wise) approach to simple bit shifts left/right is just an integer multiply by 2 to shift left, and divide by 2 to shift right.

Integer math executes very fast; I almost always use the multiply style when I want to alternately execute different subroutines on different scans for load balancing. When you multiply the to one spot past its max left position, you use that bit to re-load a one in the register and you're good to go for next cycle.
 
Back
Top Bottom