Shift register

Divad016

Member
Join Date
Nov 2003
Posts
2
I am still confused about shift registers.
I am building a machine to defect lumber.
A crayon is used to mark the defect.
A sensor sees the mark and sends input to plc.
I have an encoder on the wheel that is feeding the lumber
into the machine. The distance between the sensor and the saw
blade is short but it is still far enough away that two marks
can pass the sensor before the blade cuts.
I do not understand how to use (shift register) to solve my
problem. How is the encoder still counting in the shift register?
I tried to ask this as simple as possible. If more info is needed
Please ask questions.
Thanks.
 
Without realizing it, you have just given an exellent example of a 'real life' shift register!... :D

Step back a minute and think about how your crayon mark works. At some point upstream, the crayon mark is put on the log to mark where to cut. Think of this crayon mark as putting a "1" in a shift register. For that matter, go ahead and WRITE the number "1" on the log with the crayon!

Now 'shift' the log forward. You crayon "1" has moved with it. That "1" will move in the shift register exactly the same way.

Each time you 'shift' the log forward, you either A.) mark the log, or B.) don't mark the log. Instead of NOT marking the log, write a zero on it instead. This is what the shift register will do.

Notice that you can have multiple "1"s on each log. Similarly, you can have multiple "1"s in your shift register! They don't disappear.

I'm not the best at explaining things, but maybe your 'log example' can serve as a basis to help others explain it better... :confused:

Terry can probably write a great story about it!... ;)

beerchug

-Eric
 
Hi,

To cut or not to cut...
Saw or jigSaw... banghead

The main purpose of this programming technique is twofolds :
- you separate your problem in several basic problems
- you miraculously solve a non-sequential problem.

Point1 : automate your saw. It has to run each time some bit comes true. Done ? OK

Point2 : automate the sensing input. Pretty simple : a sensor reads your mark. Done ? OK

Point3 :unsure: send these informations from Point2 to Point1. As you reported, one or two or no faulted piece happen to be present at a time...

Here is the non-sequential part.

Now imagine your shift register as a PIPE LINE. Fill it with an information describing your pieces at Point2. On the other side, Point1 reads these informations and decides from its own if it has to cut or not. In the PIPE LINE, your informations are moved or pushed as fast as your conveyor runs by your encoder pulses. Each pulse means some distance. Branch these pulses to your register's "clock" input. OK? This way, you displace informations simultaneously with your pieces (Each piece in fact is moved with its data) Now let's see the

Point4 : :cool: "automate" the "data I/Os and motion" in your PIPE LINE. Register's input : you set a bit when your sensor reads the mark. Register's "output" : identify the register's bit corresponding to the distance between your sensor and your saw. You remember : a encoder pulse and in fact a register's bit IS a distance ! This bit you identified becomes the start information for Point1 program. That's it. But carefully select your "output" bit : due to your conveyor's speed and delays added by saw's movements...

Further informations (dig in please, it's a very common problem) :
- Try to find out other "similar" cases around you. For example, how can you send on conveyors some pieces of wood (or letters, luggages...) and make them falling right in their destination boxes ? So many pieces on the conveyors at a time :confused:
- Pipe lines exist in fact as a memory data transfer and management technique (or concept) in many non-PLC programming environments. Many powerful applications in your programs in the future...
- Imagine what you could build with shift registers or PIPE LINES containing serialized numeric data. And what about programs with parallel shift registers ?

Did this help ?

Laurent
 
Hi,

The first thing you need to consider is; what is the minimum distance that two marks will ever be apart?

You then need an indexing distance which is less than that. (ideally there will be no more than 16 of these units between the sensor and the saw, otherwise you may need to use multiple shift registers)

Now, every time the encoder measures the indexing distance you increment (turn on the clock input) the shift register. If you have detected a mark during the movement of the log, have the data input on, otherwise leave it off.

If the saw is for example 10 indexing units from the sensor perform a cut every time output bit 10 comes on.

Of course if the greater the indexing distance, the less accurate the cut position will be. To get more accuracy you will need to use a shorter indexing distance and multiple shift registers. (i.e. the last output bit of SFT1 = first input bit of SFT2... etc. At least that's how I would do it. There may be better ways that I don't know about!)

If you're still unsure about shift registers try and follow the excellent example here on this very web site!

regards

Anthony
 
Last edited:
Thanks everybody!
I actually get it now.
Its funny that once its understood it seems too easy.
Two more questions though.
If my saw does not cut directly on the mark should I then choose
a different output bit either higher or lower in the register depending on which side the blade missed the mark?
Should I ever have reason to clear the shift register in this application?
Thanks again. (y)
 
Originally posted by Divad016
If my saw does not cut directly on the mark should I then choose
a different output bit either higher or lower in the register depending on which side the blade missed the mark?

That sounds about right. Should be a lot easier than moving the saw!... :D

Originally posted by Divad016
Should I ever have reason to clear the shift register in this application?

One scenario where you would want to clear the shift register is if you manually remove the log. This way you don't activate the saw with nothing (or something ELSE!) in the saw.

beerchug

-Eric
 

Similar Topics

I am attempting to reject a bottle If the label fails. The rejection works fine at normal line speed but at low speed the rejector fires (air...
Replies
35
Views
1,101
Hi guys, I am pretty new when it comes to programming. I am working with CX-Programmer and I am having a problem where I have a sensor on my...
Replies
6
Views
673
Hi all, i have a very slow indexing machine where we are looking to make everything as bulletproof as possible, money is not much of a factor...
Replies
12
Views
3,046
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,636
Hi everyone I am completely new to using shift registers and am a bit stuck, my shift register works as should, it is for an overhead conveyor...
Replies
55
Views
15,534
Back
Top Bottom