0% found this document useful (0 votes)
17 views24 pages

Binary Logic. AND Gate

The document introduces binary logic and its connection to the binary number system, emphasizing the role of logic gates, particularly the AND gate, in computing. It explains how binary logic operates using true/false values and how logic gates perform Boolean operations based on input combinations. Key concepts covered include truth tables, the significance of two's complement for binary subtraction, and the fundamental Boolean operators: AND, OR, and NOT.

Uploaded by

Alistair Frame
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views24 pages

Binary Logic. AND Gate

The document introduces binary logic and its connection to the binary number system, emphasizing the role of logic gates, particularly the AND gate, in computing. It explains how binary logic operates using true/false values and how logic gates perform Boolean operations based on input combinations. Key concepts covered include truth tables, the significance of two's complement for binary subtraction, and the fundamental Boolean operators: AND, OR, and NOT.

Uploaded by

Alistair Frame
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

FOUNDATIONS

OF
COMPUTATIONAL
THINKING AND PROGRAMMING

Binary Logic & Gate


Revising ideas from today and the
previous lesson
1. What are the two systems for binary subtraction?
2. Which of these two systems is better and why?
3. When adding in two’s complement, what happens if we end
up with 9 bits because of a carry?
Revising ideas from today and the
previous lesson
1. Sign and magnitude and two’s complement
2. Typically, we accept that two’s complement is a better system
because it allows us to do calculations between positive and
negative numbers
3. We disregard the left-most carry if it is generated.
Learning outcomes
1. To introduce the idea of ‘Binary logic’
2. To connect the idea of Binary logic to binary number system
and decision-making in computing systems
3. To learn about the AND Logic Gate
Introducing Binary logic

• At the most basic level, we agree that any


electronic device can recognise the
presence of an electrical current or
voltage.
• If the current is present there is usually an
indication to the user in a form of a visual
signal (for example a light on a computer
monitor to indicate it is receiving the
signal)
Introducing Binary logic

• In computing devices, the voltage is


measured as either 0 or 1, high or low, on
or off.
• We covered some of this information in
Week 3 of the course when we talked
about Electricity, bits and transistors
Introducing Binary logic

• The flow of electricity inside the brain of your computer or the


CPU is controlled by millions of microscopic transistors
• By manipulating the flow of electricity, the computer controls
ON and OFF signals

0
Introducing Binary logic

• Through manipulating electrical signals


into 1s and 0s computers are able to
represent data in binary
• We know that computers not only store
data but can perform multiple complex
calculations on the strings of 1s and 0s
• Computers that can perform these
operations use binary logic
Introducing Binary logic

• Binary logic is a system for describing


logical statements where there are only
two possible values: true or false
How does this connect to the binary
number system?
(answer on the next slide)
Introducing Binary logic

How does this connect to the binary


number system?
The answer is that a bit can be one of two
values: 0 or 1, or true(1) or false(0)
Let’s have a look at an example of a logical
statement and connect it to binary logic
Exploring Binary logic

If a shape has 4 straight sides,


And if the shape has four right angles,
Result: the shape is a rectangle

How many conditions are there in the


statement above? What would happen if
one of the statements was not ‘true’?
Exploring Binary logic

If a shape has 4 straight sides,


Does it Does it Is it a
And if the shape has four right angles, have have rectangle
four four ?
Result: the shape is a rectangle sides right
angles?
False False False
Both statements must be true for the
result to be true as well. For these types of False True False
operations, we use the logical operator
True False False
AND to join the statements together.
Look at how this logic is expressed in the True True True
table on the right
Exploring Binary logic

• The table on the right is known as a ‘truth


table’. This is a type of table that
expresses all the possible conditions A B Output
(inputs) and their possible results 0 0 0
(outputs)
• Since we have two conditions (inputs) we 0 1 0
could represent them using A and B 1 0 0
• And we could represent the ‘False’ and
1 1 1
‘True’ with 0s and 1s
• What we end up with is a Truth Table AND Truth Table
AND Logic Gate

• In the statement we had previously, we had 2


conditions that had to be filled for the output
to be ‘True’: A AND B A B Output
• The AND expression is performed by the AND
Logic Gate (many of these live in the CPU) 0 0 0

• Logic gates are electronic devices 0 1 0


(transistors and circuits) that perform
Boolean logic 1 0 0

• Boolean logic is centred around 3 Boolean 1 1 1


operators: AND, OR and NOT
• Logic gates use these three expressions to AND Truth Table
build outputs
Introduction to Logic Gates

• Every logic gate performs different A B Q


operations in terms of output
0 0 0
• Each gate could be represented by a truth
table to simplify the output 0 1 0
• Inputs are usually expressed as A, B or C 1 0 0
and output is usually expressed as P or Q
1 1 1

AND Truth Table


Introduction to Logic Gates

• Each logic gate could be expressed A B Q


diagrammatically in different ways
0 0 0
• For example, this is the diagram for the
AND Logic gate 0 1 0

1 0 0

A 1 1 1
Q
B AND Truth Table
AND Gate

A B Q

0 0 0

• Every logic gates takes a Boolean 0 1 0


expression. The Boolean expression of the
AND gate is written as follows: 1 0 0

Q=A∧B 1 1 1
where ∧ represents AND AND Truth Table

A
Q
B

AND Logic Gate


AND Gate Questions

Now that you know how the AND gate


works, do the following 1 exercises:
1. If the input for A is 0 but for B is 1,
what is Q?
2. If the input for A is 1 but for B is 0, A
what is Q? Q
B
3. If the input for A is 1 and the input
for B is one, what is Q? AND Logic Gate
(answers on the next slide)
AND Gate Questions

1. Q is 0
2. Q is 0
3. Q is 1 A
Q
B

AND Logic Gate


AND Gate summary
AND gates = takes 2 input wires
• If both of the wires are 'On', the AND gate will output 1
• If even one of the wires is 'Off', the AND gate will output 0
• If both of the wires are 'Off' the output will be 0
What we learned today
1. We discussed the idea of ‘Binary logic’
2. We connected the idea of Binary logic to binary number
system and decision-making in computing systems
3. We discussed the first Logic Gate: AND
Revising ideas from today
1. What is a logic gate?
2. What is a truth table?
3. What are the three Boolean operators?
4. What letter(s) do we normally use to represent ‘output’ in a
truth table?
5. If the output for an AND gate is Q = 1, what are the possible
inputs if any?
Revising ideas from today
1. What is a logic gate? Small electronic circuits that
perform Boolean operations based on input or
combinations of inputs
2. What is a truth table? A table used in logic to
represent all the combinations of values for inputs
and their corresponding outputs
3. What are the three Boolean operators? AND, OR and NOT
4. What letter(s) do we normally use to represent ‘output’ in
a truth table? Q or P
5. If the output for an AND gate is Q = 1, what are the
possible inputs if any? A = 1 and B = 1
Topics and key vocabulary from today:

• Binary logic
• What questions do
Boolean operators
you have at the
• AND Gate end of this lesson?
• Logic Gates
• Truth table

You might also like