Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

8-bit Shift Register Problem with design

Status
Not open for further replies.

GP12

New Member
Hi! I'm a student of Electric Engineering and I got a problem on a Electronic project. I have to make an 8-bit shift register with serial input and serial output. The basics of the project is that it has to have two push buttons: one will be a logic 1 and the other a logic 0. The shift register has to somehow show the 'move' of the register to see that it works, so I planned on using 8 LEDs that will work like this: when I press button 1, it has to turn on a LED and when I press 0, the LED has to turn off. If I make a secuence, for example, 01100101, being the first 0 the last bit I pressed and the last 1 the first bit, the LED configuration shall be the same: Off - On - On - Off - Off - On - Off - On. The hard or difficult part of the project is that I'm not allowed to use any type of IC nor Digital Electronic, just transistors and pasive components. I attach my previous design, there can be seen the configuration of the two pulses and two masters slaves but the connection of the rest of the masters slaves was the same, it didn't work as I thought it will be, LEDs automatically turn on (except the first one) when I start simulating or when I connect the circuit in protoboard. I was trying to use a Master-Slave configuration to make it work, the clock and input D I assumed that should be separated, that's why I put a relay to separate them. The logic 1 I made it by energizing input and clock with the same pulse, while the logic 0 I made it by just enegizing the clock. I was using 2N2222A transistors in that task in NAND and NOT configurations. If you could help me or give some ideas I would really appreciate. Thank you!
 

Attachments

  • Pulses and 2 masters-slaves.jpeg
    Pulses and 2 masters-slaves.jpeg
    86.1 KB · Views: 169
You need your pushbuttons to behave differently. You want one pushbutton for the data, 1 (pushed) and 0 (released) and one to move the data along, the clock.

So to enter a 1, press and hold the data pushbutton. While holding it down, press and release the clock pushbutton.
To enter a 0, release the data pushbutton, and press and release the clock pushbutton.

Your circuit diagram isn't clear. It's not obvious if wires join or cross. Also you have doubled up on transistors where one would do, such as the ones in the bottom left. Also the resolution doesn't show the component numbers. The transistor type isn't relevant so that shouldn't be shown.

Your circuit hasn't got any memory structures. It needs at least 8. The normal arrangement is to have the collector of one transistor connected to the base of a second, and the emitter of the second connected to the base of the first, and suitable pull-up resistors. That will remember 1 bit, because one transistor will be on, preventing the other from turning on.

A simple concept may not be the simplest circuit. A simple concept would be to have 8 masters and 8 slaves. When the clock button is pressed, the state of the master is transferred to the slave. When the clock button is released, the state of the slave is transferred to the master of the next bit in the shift register.
 
You need your pushbuttons to behave differently. You want one pushbutton for the data, 1 (pushed) and 0 (released) and one to move the data along, the clock.

So to enter a 1, press and hold the data pushbutton. While holding it down, press and release the clock pushbutton.
To enter a 0, release the data pushbutton, and press and release the clock pushbutton.

Your circuit diagram isn't clear. It's not obvious if wires join or cross. Also you have doubled up on transistors where one would do, such as the ones in the bottom left. Also the resolution doesn't show the component numbers. The transistor type isn't relevant so that shouldn't be shown.

Your circuit hasn't got any memory structures. It needs at least 8. The normal arrangement is to have the collector of one transistor connected to the base of a second, and the emitter of the second connected to the base of the first, and suitable pull-up resistors. That will remember 1 bit, because one transistor will be on, preventing the other from turning on.

A simple concept may not be the simplest circuit. A simple concept would be to have 8 masters and 8 slaves. When the clock button is pressed, the state of the master is transferred to the slave. When the clock button is released, the state of the slave is transferred to the master of the next bit in the shift register.
I'm sorry for the incomplete image, I've got a link where you can see the complete structure of the circuit. One thing, though, I need that one button does the logical 1 by itself, not a mix of actions. That's why I put a relay on it, so the pulse con activate both the clock and data while the 0 can only affect the clock. I think you can see the project more in detail at EasyEDA, here's the link, I would appreciate it a lot. https://easyeda.com/alexander_2000/Proyecto-E1 R
Thank you!
 
I see what you are doing now with the relay, so that the data is set up before the clock pulse. A small delay using a resistor and a capacitor would be the easier way of doing it.

Your circuit diagram isn't easy to follow but it seems to be doing the right thing. I found adding labels on the wires on the circuit diagram helped me to understand it.

On your circuit, the zero push button is in effect the clock. On each slave flip-flop the clock is inverted, although the way the connection snakes around your circuit diagram makes that really difficult to see.

You don't have any switch debounce, so when you press the 0 button, or when the relay operates, the clock line, the clock line may go up and down several times very quickly.

Also you don't have a reset line. When there is no button pressed, the clock line is low, and each of the master flip flops is in an unknown state.

I suggest that you:-
Add an LED to the master flip flops as well as the slave ones.
Debounce the switch inputs.
Have just one inverted clock line for all 8 slave flip flops.
Add a delay to the inverted clock line.
Adding a reset line, or even just resetting all 8 master flip flops each time you turn on.

For testing, you could even have a separate push button to operate the inverted clock line. That would allow you to see the data going from the input (or the slave of the previous stage) to the master when the clock is operated, and then the data going from the master to the slave when the inverted clock is operated.
 
I see what you are doing now with the relay, so that the data is set up before the clock pulse. A small delay using a resistor and a capacitor would be the easier way of doing it.

Hahaha, no. That's not exactly what I want, the function of the relay is to separate the clock line from the data. When I press pulse 1, it will give a 1 to the data input of the master slave but also will activate the clock. In the other case, pulse 0, will only activate the clock, that's my basic idea. I tried to separate the clock from data with a diode, but it didn't work as I expected in the simulator. It activated some of the LEDs just by turning it on...


Your circuit diagram isn't easy to follow but it seems to be doing the right thing. I found adding labels on the wires on the circuit diagram helped me to understand it.

On your circuit, the zero push button is in effect the clock. On each slave flip-flop the clock is inverted, although the way the connection snakes around your circuit diagram makes that really difficult to see.

Took note of this and I tried to fix it. I didn't think of this.

You don't have any switch debounce, so when you press the 0 button, or when the relay operates, the clock line, the clock line may go up and down several times very quickly.

Sorry, can you explain me more of this? I'm not familiar witch switch debounces, I think that's a main problem. In simulation, the circuit does well the first 4 LEDs, but then it doesn't work as expected and loses the data and from there it won't work.

Also you don't have a reset line. When there is no button pressed, the clock line is low, and each of the master flip flops is in an unknown state.

Okay, took note of that too. I added a reset line in the circuit. I changed the structure of the master, somehow imitating a JK flip flop.

Thank you very much for your advices.
 
You should be able to separate the data line from the clock with a diode, so that the 1 causes the data line and the clock to go up, but the 0 just causes the clock to go up. The important thing is to delay the clock line, so that the data line goes up first, then the clock. If the data and the clock line change at the same time, then it's not clear whether a 1 or a 0 is latched.

That is described here:- https://en.wikipedia.org/wiki/Race_condition

Switch bounce and the fixes for it are described here:- https://en.wikipedia.org/wiki/Switch#Contact_bounce
 
You should be able to separate the data line from the clock with a diode, so that the 1 causes the data line and the clock to go up, but the 0 just causes the clock to go up. The important thing is to delay the clock line, so that the data line goes up first, then the clock. If the data and the clock line change at the same time, then it's not clear whether a 1 or a 0 is latched.

That is described here:- https://en.wikipedia.org/wiki/Race_condition

Switch bounce and the fixes for it are described here:- https://en.wikipedia.org/wiki/Switch#Contact_bounce
Thank you so much. It worked. It has some problems in the first pulses but I will try to fix it. Thanks again.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top