1. 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.
    Dismiss Notice

[Solved] AND as logic switch?

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by johnyradio, Aug 9, 2017.

  1. johnyradio

    johnyradio Member

    Joined:
    Jun 16, 2012
    Messages:
    29
    Likes:
    0
    Hi

    Based on the logic table for AND gates, i should be able to use either as a simple digital switch. That is, say input 1 is running at 40khz, and input 2 is 1 Hz. Then, every second, our output should toggle between 0 for half a second, then 40kHz for half a second. Correct?
    http://www.electronics-tutorials.ws/boolean/bool_1.html

    I'm not getting that in this falstad. What am i doing wrong?
    http://tinyurl.com/y92bwo98

    thx!
     
  2. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,903
    Likes:
    502
    Location:
    Cleveland, OH, USA
    ONLINE
    Your signals are 40 Hz (not kHz) and 1 Hz. The timing changes about every 25 ms, which seems about right.
     
  3. johnyradio

    johnyradio Member

    Joined:
    Jun 16, 2012
    Messages:
    29
    Likes:
    0
    My bad, changed to 40kHz.
    http://tinyurl.com/y9v6uml8

    What i'm seeing does not make sense to me. I should see a 40kHz signal that lasts for 1/2 second, then no signal for 1/2 second, then repeat.

    Right?

    Why 25ms?

    thx
     
    Last edited: Aug 9, 2017
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,903
    Likes:
    502
    Location:
    Cleveland, OH, USA
    ONLINE

    40 Hz is 25 ms per cycle.

    Just did an LTSpice simulation. Same result:

    upload_2017-8-9_5-46-58.png



    Note, since the logic is AND, when either input is off, the output is off. And as expected, when the 1 Hz is on, the output will switch on and off at 40 kHz. That is what you are seeing (I suspect), if you zoom in on your time scale.

    John
     
  6. johnyradio

    johnyradio Member

    Joined:
    Jun 16, 2012
    Messages:
    29
    Likes:
    0
    Not seeing that. Just seeing continuous oscillation at output.

    Can you check this? I zoomed in.
    http://tinyurl.com/y78psgqh

    where does your sim go further to the right?

    thx
     
    Last edited: Aug 9, 2017
  7. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,903
    Likes:
    502
    Location:
    Cleveland, OH, USA
    ONLINE
    You have to run your simulation longer. I ran your simulation and it switched from 40 kHz pulses to off and visa versa every 500 ms.

    I only posted a snippet at the change from pulses to off. It repeats, if one runs the simulation longer.
     
  8. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,903
    Likes:
    502
    Location:
    Cleveland, OH, USA
    ONLINE
    Your simulation does exactly the same as mine did:

    upload_2017-8-9_6-30-26.png

    Why would you expect it to be any different?
     
  9. johnyradio

    johnyradio Member

    Joined:
    Jun 16, 2012
    Messages:
    29
    Likes:
    0
    ok, i was just not waiting long enough. Solved. thx everyone for your time!
     

Share This Page