# [Solved] AND as logic switch?

Status
Not open for further replies.

##### Member
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!

#### jpanhalt

##### Well-Known Member
Your signals are 40 Hz (not kHz) and 1 Hz. The timing changes about every 25 ms, which seems about right.

##### Member
Your signals are 40 Hz (not kHz) and 1 Hz. The timing changes about every 25 ms, which seems about right.
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:

#### jpanhalt

##### Well-Known Member
40 Hz is 25 ms per cycle.

Just did an LTSpice simulation. Same result:

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

##### Member
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.
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:

#### jpanhalt

##### Well-Known Member
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.

#### jpanhalt

##### Well-Known Member
Your simulation does exactly the same as mine did:

Why would you expect it to be any different?