producing clock pulse from 4 switches

Discussion in 'The Projects Forum' started by Xufyan, Apr 29, 2011.

  1. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    please have a look at the attachment, every time any of the switch turned on or off , one of the two diode will be activated and other one will deactivated,
    for example:

    suppose the two diodes are D1 and D2, if all 4 switches are on , D1 diode is activated and hence the output is '1' if we then turn off any of the switch then D1 will be deactivated and D2 will be activated, there will be a little delay in activation of second diode before the output is 1 ,
    so can i use it as input to the counter as a clock ???

    i tried inputting it as a clock for a 3-bit counter but the counter is counting down instead of up (the first state of the counter is 111 instead of 000 :( )

    also the counter is changing its state after two inputs,
    for example,
    the initial state of the counter using the above clock is '111' when i change any of the switch from on to off or off to on the counter doesn't changes its state (it remains 111) when the second time i change any switch from off to on or on to off the counter change its state from '111' to 110.

    1) How can i make the counter count from 000 instead of 111?
    2) how can i designed it that the counter increases on each switch state change ?


    please reply, i designed everything myself and stuck here.
     
  2. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    I read your post and looked at your print. I then re-read your post and looked at the print again. I'm afraid I don't know what you're asking. I see no circuit here that resembles a clock.

    What's that curly-que on the output? :confused:
     
  3. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    i am using the ouput of attached circuit as a clock into 3bit counter flip flop , it is working but the counter is counting from down to up,

    now see this circuit diagram

    [​IMG]

    when simulation starts the first state of the counter is '111' = 7 and every time when i change the switch state from off to on the the counter starts counting (second state of counter becomes '110' = 6 )

    now how to make it count up instead of down ?
     
  4. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    I suspect you are dealing with a steady state problem. Are you wanted a pulse every time a switch is toggled or what?

    If you then you will need to rethink your approach. A simple capacitor/ resistor to create a transitory pulse is need (and a second one for an inverted signal). No XOR gates needed.
     
  5. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    yes i want pulse every time a switch is toggled, can you give some idea ??
    i dont know where to use capacitor or resistor. (not good in electrical components)
     
  6. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    [​IMG]

    Something like this maybe?
     
  7. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    Sorry but i didn't understand this :S
    i have four switch that must create clock pulse every time any of them toggled, but i didn't understand your circuit
     
    Last edited: Apr 30, 2011
  8. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    This is one of the four switches.

    The capacitor is discharged, the input to the chip is low.

    You switch one side to Vcc, it allows a short pulse through, then settles down to ground again (low).

    Switch it back, Vcc in no longer on the cap, it discharges.

    The other side of the switch does the same thing, only inverted. Only the positive edge goes through, which is why two contacts are used.

    There will be a pulse for each position, just OR them together.

    This is a very basic circuit, you really need to take the time to understand it, otherwise your career is not going to go well.

    In real life it may be a bit bouncy. I can fix that if it is a problem.

    Or I could have used 2 monostable circuits.
     
  9. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    OK, now i have applied monostable multivibrator (www.falstad.com/circuit/e-multivib-mono.html)

    the counter is still counting down..see the circuit, (i didn't understand your logics at all as we are still learning the basics :( ) sorry but i cannot understand your tough logics.

    and you've said that career will not going to go well, let me tell you this is not a mandatory subject regarding my career as i am doing Telecom engineering , DLD is just a 6 months course for us to learn the basics of gates, counters etc

    [​IMG]
     
    Last edited: Apr 30, 2011
  10. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    You didn't try my circuit, and you totally didn't get the monostable reference. A monostable for each position of the switch, each switch has two contacts, for a total of 8 monostables.

    I'm gathering this is a homework assignment, and you missed some key classes.

    When I referred to the steady state problem, I'm talking about there is nothing that will generate a simple pulse by flipping a switch. Worse, if I understand your problem, you need to generate a pulse if the switch is flipped either way.

    The work has to go both ways. Merely declaring you don't understand is not sufficient, if you have a question I would be happy to try to explain. But you have to ask the questions.

    The world of digital must include some analog concepts. I suspect you haven't had some of the classes.

    The attached circuit will work, I included a debounce.

    These are debounce circuits...
    [​IMG]

    And this will do what you are requesting...
    [​IMG]
     
    Last edited: Apr 30, 2011
  11. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    Hey i have understand your Circuit thankyou, and with the help of DLD floyd book i understand what Debnouncing actually is and how RS flip can be used to remove debouncing from the circuit and produce digital 0 1 pulse :)

    Thank you :)

    I have connected clock of 2nd flip flop to the Q(bar) or 1st and clock of 3rd flip flop to the Q(bar) of the second :)

    thanks alot it is working like a charm in multisim, just need to verify it on bread board...

    btw, the pin configuration of 4027 Ic is different in multisim and in actual it is different, that is why it was not working on the bread board, hopefully it will work now :)

    however the counter counting after two toggles not 1 :( is there any way to fix it ?
     
    Last edited: May 4, 2011
  12. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    Doesn't work on breadboard :( can you please help me sorting it out , i have to show it on monday :(

    working fine on multisim but when i assemble it on bread board and toggle any of the switch the counter counts randomly , like 1 , 3 ,2 ,0, 7 etc...

    I've tried it by using Or gate but count doesnot change when i ORed the four switches.
    i request you to please have a look to attached multisim circuit , thankyou .
     
  13. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Sorry, I do not use multism, when I design it is with M/S Paint and the computer between my ears. I can not even look at the file you have.

    What is it doing (or not doing)?

    Are you familiar with screen shots? When you have an image on the computer screen you can capture the entire screen with the key "Print Scrn" next to F12. You can then transfer this image into a Paint graphic, use the .png format to save it.

    My first guess is your values need tweaked for the capacitors and resistors. What IC are you using for the gates?
     
    Xufyan likes this.
  14. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    The circuit works absolutely fine on Multisim, (counting up to down after every two toggles) however on connecting it on bread board the counter is counting randomly when i toggles the switch.

    i've used the same ICs on bread board as mentioned in the circuit attached.

    pelase help me i have spent over three weeks designing a whole circuit and this switching counter is a small part of my circuit , my circuit is useless without it.
     
  15. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    <sigh> You have the debounce, but you left the part that would produce the pulse per switch out. The debounce will help introduce a delay which might improve performance, but you need a short pulse every time the circuit is switched. I showed you how to do this.

    I guarantee this will work.

    [​IMG]

    The little diagram on top shows why.

    With the gate arrangement you have, there will be no pulses. One input nulls the other out. Try going through all the logic states, drawing 1 and 0 on the output for each switch position. Where is the pulse supposed to come from?

    With logic you have to occasionally diagram, do not assume you have the method figured out.

    A two input XOR Gate feed with two switches

    A B Out
    0 0 1
    0 1 0
    1 0 0
    1 1 1

    Note these are steady state signals. The output changes, but it does NOT produce a pulse. Flip flops respond to pulses, the output goes high, then low. Merely toggling from low to high, or high to low, is not enough.
     
    Last edited: May 5, 2011
    Xufyan likes this.
  16. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    i have designed the circuit but every time i run the circuit and toggle the switch the diode bursts !!! i have set all the capacitors to 1uf and resistors to 1k
     
  17. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    There isn't any way the diodes will blow, but drop the capacitors to 0.1µF and the resistors to 10KΩ to narrow down those pulses. The diodes are there to absorb the negative spike shown on the top of the schematic, leaving only the positive pulse to use. Since the spike is very narrow, the diode is safe.

    Simulators don't always work as expected. Yours is treating the components as ideal (they aren't, the capacitors and diodes have resistances not being accounted for). The diodes are safe.

    I meant to mention it before, but use Schmitt Trigger style gates, it is in the schematic, but a 7404 is not it. Think 7414 or 10106.
     
    Last edited: May 6, 2011
    Xufyan likes this.
  18. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    the diode i am using is 1N914,
    i have change the capacitor to 0.1uf and resistor to 10k but still the same effect

    [​IMG]
     
  19. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Again, there is absolutely no way you will get 50V there. None. The voltage will try to go to -4V for a very short while, but the diode will not let it, it will short this out (as it is meant to). This is called swamping. Your simulator is malfunctioning.

    It is one of the reasons I think it is a bad idea to depend on simulators too heavily. With a 4V power supply you can get 8Vpp, but the diode clips half of that.
     
    Xufyan likes this.
  20. Xufyan

    Thread Starter Member

    Aug 3, 2010
    114
    0
    Thankyou , its working now :)
     
Loading...