AND gates
Categories: logic logic gates
Think about what happens when you get into a lift - the doors close, you press the button to say which floor you want, and the lift starts moving.
What happens if the doors close but you don't press a button to choose a floor? Nothing happens. The lift doesn't know which floor you want, so it stays where it is.
Alternatively, what happens if you are too quick to press the floor button, and press it before the doors have closed? Well, of course the lift doesn't start moving, that would be extremely dangerous. It will wait until the doors close.
The lift will only move if the door is closed AND you have pressed a floor button. The door has a sensor which produces an electrical signal when the door is closed. The floor button produces an electrical signal when you choose a floor. The control circuit inside the lift monitors both input signals, and only when they are BOTH on, it produces an output signal to drive the lift motor.
This type of circuit is called an AND gate.
AND gates
An AND gate has two input signals and one output signal.
The two input signals can each be either on or off. When we describe logic gates we normally refer to these states as 0 or 1.
The state of the inputs controls the state of the output. The output value is 1 (on) if both inputs are 1, otherwise it is 0 (off). It is called an AND gate because the output will only be 1 if inputs A AND B are both one.
Symbol
Here is the symbol for an AND gate. The inputs are labelled A and B, the output is labelled Q.
Truth table
A truth table is a table which shows all possible combinations of inputs (A and B), and the resulting value of the output, Q. Here is the truth table for an AND gate, as you can see the output is only 1 if both inputs are 1.
Video
See also
Sign up to the Creative Coding Newletter
Join my newsletter to receive occasional emails when new content is added, using the form below:
Popular tags
555 timer abstract data type abstraction addition algorithm and gate array ascii ascii85 base32 base64 battery binary binary encoding binary search bit block cipher block padding byte canvas colour coming soon computer music condition cryptographic attacks cryptography decomposition decryption deduplication dictionary attack encryption file server flash memory hard drive hashing hexadecimal hmac html image insertion sort ip address key derivation lamp linear search list mac mac address mesh network message authentication code music nand gate network storage none nor gate not gate op-amp or gate pixel private key python quantisation queue raid ram relational operator resources rgb rom search sort sound synthesis ssd star network supercollider svg switch symmetric encryption truth table turtle graphics yenc