CS 0447 Introduction to Computer Programming Luís Oliveira
Fall 2020
Logic Basics
Original slides by: Jarrett Billingsley Modified with bits from: Bruce Childers, David Wilkinson
Logic Basics Lus Oliveira Original slides by: Jarrett Billingsley - - PowerPoint PPT Presentation
#C CS 0447 Introduction to Computer Programming Logic Basics Lus Oliveira Original slides by: Jarrett Billingsley Modified with bits from: Bruce Childers, David Wilkinson Fall 2020 What's electric icity? (E (EE-ish sec ection) 2 In
CS 0447 Introduction to Computer Programming Luís Oliveira
Fall 2020
Original slides by: Jarrett Billingsley Modified with bits from: Bruce Childers, David Wilkinson
(E (EE-ish sec ection)
2
3
e-
here's a proton. it has a positive charge here's an electron. it has a negative charge it kinda goes around the proton in an orbit*
*it actually doesn’t… it’s way more complex than that! Waves, teleportation and other black magic!
protons sit still while electrons can move around
4
attract two of the same charge repel here's electricity. here it is but protons are kinda stuck, so…
5
here's a solid piece of metal the atoms are in a fixed structure but some of the electrons are free to move around right now, the charges are balanced: same number of positive and negative let's knock it out of whack
6
let's shove more electrons in packing more electrons in leads to two things:
negatively charged
now closer together meaning they're less happy
aaa noo
7
and then give them a (difficult) way out and then have something which will squeeze them back together again well now you have electricity if we shove some down a wire
we'd like to get off mister bones wild ride
8
voltage measures electron unhappiness current measures how many electrons per second are moving past a point low high low high and that's electricity
9
10
https://en.wikipedia.org/wiki/Vacuum_tube
11
MOSFET BJT There are multiple types of transistors
input
common input
Can be used many different ways!
12
The positive terminal (e.g. 9V) The negative/ground terminal (0V)
▪ controls the switch state
13
Input Output D S G
14
This means inverted
G=0 G=1 ON OFF
15
1 D S G 1 S D G “N” Type “P” Type
16
Now just put 3 billion
said EE was hard?
17
this little bubble means "invert"
A is the input Q is the output
18
19
A=0
1
20
A Q B
A A B Q B
21
A Q B
A A B B Q
22
A A B Q B A Q B
23
A A B B A Q B Q
24
A Q B
AND gate
A Q B
OR gate
A Q B
XOR gate
eXclusive OR means "one or the other, but NOT BOTH."
AB A+B A⊕B
you can just concatenate:
25
AND gate
AND gate
combining logic gates:
26
It’s truth when “A is false” and “B is true” and “C is false” OR “A is false” and “B is true” and “C is true”
27
B A Q C
28