1 / 68

3 – Boolean Logic and Logic Gates 4 – Binary Numbers

Learn the basics of binary numbers and boolean logic, including the concept of bits, boolean operations, and logic gates. Understand how these fundamental principles are used in computer technology.

annbarnes
Download Presentation

3 – Boolean Logic and Logic Gates 4 – Binary Numbers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 3 – Boolean Logic and Logic Gates4 – Binary Numbers CS 1 Introduction to Computers and Computer Technology Rick Graziani Fall 2017

  2. BIT – BInary digiT • Bit (Binary Digit) = Basic unit of information, representing one of two discrete states. The smallest unit of information within the computer. • The only thing a computer understands. • Abbreviation: b • Bit has one of two values: • 0 (off) or 1 (on) • 0 (False) or 1 (True) ON OFF Rick Graziani graziani@cabrillo.edu

  3. Bits • Two patterns are known as the state of the bit. • For example, magnetic encoding of information on tapes, floppy disks, and hard disks are done with positive or negative polarity. The boxes illustrate a position where magnetism may be set and sensed; pluses (red) indicate magnetism of positive polarity (1 bit), interpreted as “present” and minuses (blue) (0 bit). 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0 1 Rick Graziani graziani@cabrillo.edu

  4. Bits • Bits are really only symbols. • Used to display the one of two different, discrete states. • Bits are used as: • Storing data • Numbers • Text characters • Images • Sound • Etc. • Processing data Rick Graziani graziani@cabrillo.edu

  5. Boolean Operations • Integrated Circuits (microchips) are used to store and manipulate (process) bits. • This is done using Boolean operations (in honor of mathematician George Boole, 1815-1864). • Boolean Operation: An operation that manipulates one or more true/false values • Specific operations • AND • OR • XOR (exclusive or) • NOT • Using Truth Tables we can uses different sets of logic operations to store, add, subtract, and more complicated operations with bit. Rick Graziani graziani@cabrillo.edu

  6. Boolean Algebra and logical expressions (Addendum) • Boolean algebra (due to George Boole) - The mathematics of digital logic • Useful in dealing with binary system of numbers. • Used in the analysis and synthesis of logical expressions. • Logical expressions– Expressions constructed using logical-variables and operators. • Result is: True or False • Boolean algebra – In mathematics a variable uses one of the two possible values: 1 or 0 • May also be represented as: • Truth or Falsehood of a statement • On or Off states of a switch • High (5V) or low (0V) of a voltage level Rick Graziani graziani@cabrillo.edu

  7. Used in electronics (Addendum) • Electrical circuits aredesigned to represent logical expressions • Known as logic circuits. • Used to make important logical decisions in household appliances, computers, communication devices, traffic signals and microprocessors. • Three basic logic operations as listed below: • OR operation • AND operation • NOT operation Rick Graziani graziani@cabrillo.edu

  8. Logic gates • A logic gate is an electronic circuit/device which makes the logical decisions based on these operations. • Logic gates have: • one or more inputs • only one output • The output is active only for certain input combinations. • Logic gates are the building blocks of any digital circuit. Rick Graziani graziani@cabrillo.edu

  9. Boolean Operations - AND • Truth tables (simple ones) • AND operation • Both input values must be TRUE for output to be TRUE • Kermit is a frog AND Miss Piggy is an actress • Inputs to AND operation represent truth of falseness of the compound statement. TRUE TRUE AND = TRUE Rick Graziani graziani@cabrillo.edu

  10. Boolean Operations • Gate: • A device that computes a Boolean operation • A device that produces the output of a Boolean operation when given the operation’s input values. • Gates can be: • Gears • Relays • Optic devices • Electronic circuits (microchips) Rick Graziani graziani@cabrillo.edu

  11. Boolean Operations – AND Gate 0 = FALSE 1 = TRUE AND operation • Both input values must be TRUE for output to be TRUE 0 Truth Table 0 InputsOutput 0 0 0 0 1 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 1 1 Rick Graziani graziani@cabrillo.edu

  12. Off (False) Off (False) On (True) • To build an AND gate: Two transistors connected together • Two inputs (transistors A and B) and one output • Transistor A: Off (False) • Transistor B: On (True) • Output: Off (False) Rick Graziani graziani@cabrillo.edu

  13. On (True) On (True) On (True) • Transistor A: On (True) • Transistor B: On (True) • Output: On (True) Rick Graziani graziani@cabrillo.edu

  14. Boolean Operations - OR TRUE • Truth tables (simple ones) • OR operation • Only one input values must be TRUE for output to be TRUE • In Rick likes to surf OR Rick likes to go dancing. • Taking both courses will also TRUE. OR True = TRUE Rick Graziani graziani@cabrillo.edu

  15. Boolean Operations – OR Gate 0 = FALSE 1 = TRUE OR operation • At least one input value must be TRUE for output to be TRUE 0 Truth Table 0 InputsOutput 0 0 0 0 1 1 0 1 1 0 0 1 1 1 1 1 1 1 0 1 1 1 Rick Graziani graziani@cabrillo.edu

  16. Two inputs (transistors A and B) and one output • Transistor A: Off (False) • Transistor B: Off (False) • Output: Off (False) Rick Graziani graziani@cabrillo.edu

  17. Two inputs (transistors A and B) and one output • Transistor A: Off (False) • Transistor B: On (True) • Output: On (True) Rick Graziani graziani@cabrillo.edu

  18. Two inputs (transistors A and B) and one output • Transistor A: On (True) • Transistor B: On (True) • Output: On (True) Rick Graziani graziani@cabrillo.edu

  19. Boolean Operations - XOR TRUE • Truth tables (simple ones) • XOR operation • One and ONLY one input value can be TRUE for output to be TRUE • At noon Rick is going to surf the Hook XOR surf Liquor Stores (this is a surf spot) • Both cannot be true, as I cannot surf both spots at the same time. XOR False = TRUE Rick Graziani graziani@cabrillo.edu

  20. Boolean Operations – XOR Gate 0 = FALSE 1 = TRUE XOR operation • Only one input value is TRUE for output to be TRUE 0 Truth Table 0 InputsOutput 0 0 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 0 1 0 1 Rick Graziani graziani@cabrillo.edu

  21. Rick Graziani graziani@cabrillo.edu

  22. Rick Graziani graziani@cabrillo.edu

  23. Rick Graziani graziani@cabrillo.edu

  24. Boolean Operations – NOT Gate 0 = FALSE 1 = TRUE NOT operation • Only one input • Opposite of input NOT FALSE = TRUE NOT TRUE = FALSE Truth Table 0 1 InputsOutput 0 1 1 0 1 0 Rick Graziani graziani@cabrillo.edu

  25. Current • To build an NOT gate: One transistor • One input and one output • Transistor A: On (True) • Current flows to ground wire and none to output, so output is Off (False) Rick Graziani graziani@cabrillo.edu

  26. Current • Transistor A: Off (False) • Current flows to ground wire and none to output, so output is Off (False) Rick Graziani graziani@cabrillo.edu

  27. http://www.neuroproductions.be/logic-lab/ Rick Graziani graziani@cabrillo.edu

  28. Another way to write it… 0 = FALSE; 1 = TRUE Rick Graziani graziani@cabrillo.edu

  29. Binary Numbers

  30. Binary = Of two states Rick Graziani graziani@cabrillo.edu

  31. Binary Math Rick Graziani graziani@cabrillo.edu

  32. Base 10 (Decimal) Number System Digits (10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Number of: 104 103 102 101 100 10,000’s1,000’s100’s10’s1’s 1 2 3 9 1 0 9 9 1 0 0 Rick Graziani graziani@cabrillo.edu

  33. Base 10 (Decimal) Number System Digits (10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Number of: 104 103 102 101 100 10,000’s1,000’s100’s10’s1’s 4 1 0 8 3 8 2 1 0 0 0 9 1 0 0 1 0 Rick Graziani graziani@cabrillo.edu

  34. Rick’s Number System Rules • All digits start with 0 • A Base-n number system has n number of digits: • Decimal: Base-10 has 10 digits • Binary: Base-2 has 2 digits • Hexadecimal: Base-16 has 16 digits • The first column is always the number of 1’s • Each of the following columns is n times the previous column (n = Base-n) • Base 10: 10,000 1,000 100 10 1 • Base 2: 16 8 4 2 1 • Base 16: 65,536 4,096 256 16 1 Rick Graziani graziani@cabrillo.edu

  35. Counting in Decimal (0,1,2,3,4,5,6,7,8,9) 1,000’s100’s10’s1’s 0 1 2 3 ... 9 1 0 1 1 ... 1 8 1 9 2 0 2 1 2 2 1,000’s100’s10’s1’s . . . 2 9 3 0 3 1 ... 9 9 1 0 0 1 0 1 ... 9 9 9 1 0 0 0 Rick Graziani graziani@cabrillo.edu

  36. Counting in Binary (0, 1) 8’s4’s2’s1’s 0 1 1 0 1 1 1 0 0 1 0 1 Dec 8’s4’s 2’s1’s Dec 0 9 1 0 0 1 1 10 1 0 1 0 2 3 1 0 1 1 11 4 12 1 1 0 0 5 1 1 0 6 1 1 0 1 13 1 1 1 7 1 1 1 0 14 1 0 0 0 8 1 1 1 1 15 Rick Graziani graziani@cabrillo.edu

  37. Binary Math (more later) 0 0 1 10 11 100 101 +0 +1 +1 +1 +1 + 1 + 1 0 1 10 11 100 101 110 111 00000000 11111110 + 1 + 0 -> + 1 1000 …… 00000000 11111111 Rick Graziani graziani@cabrillo.edu

  38. Base 2 (Binary) Number System Digits (2): 0, 1 Number of: 27 26 25 24 23 22 21 20 128’s64’s32’s16’s8’s4’s2’s1’s Dec. 2 1 0 10 1 0 1 0 17 70 130 255 Rick Graziani graziani@cabrillo.edu

  39. Base 2 (Binary) Number System Digits (2): 0, 1 Number of: 27 26 25 24 23 22 21 20 128’s64’s32’s16’s8’s4’s2’s1’s Dec. 2 1 0 10 1 0 1 0 17 1 0 0 0 1 70 1 0 0 0 1 1 0 130 1 0 0 0 0 0 1 0 255 1 1 1 1 1 1 1 1 Rick Graziani graziani@cabrillo.edu

  40. Converting between Decimal and Binary Digits (2): 0, 1 Number of: 27 26 25 24 23 22 21 20 128’s64’s32’s16’s8’s4’s2’s1’s Dec. 1 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 172 192 Rick Graziani graziani@cabrillo.edu

  41. Converting between Decimal and Binary Digits (2): 0, 1 Number of: 27 26 25 24 23 22 21 20 128’s64’s32’s16’s8’s4’s2’s1’s Dec. 70 1 0 0 0 1 1 0 40 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 128 1 0 0 0 0 0 0 0 172 1 0 1 0 1 1 0 0 192 1 1 0 0 0 0 0 0 Rick Graziani graziani@cabrillo.edu

  42. Computers do Binary 0 1 • Bits have two values: OFF and ON • The Binary number system (Base-2) can represent OFF and ON very well since it has two values, 0 and 1 • 0 = OFF • 1 = ON • Understanding Binary to Decimal conversion is critical in computer science, computer networking, digital media, etc. Rick Graziani graziani@cabrillo.edu

  43. Rick’s Program Rick Graziani graziani@cabrillo.edu

  44. Rick’s Program Rick Graziani graziani@cabrillo.edu

  45. Rick’s Program Rick Graziani graziani@cabrillo.edu

  46. Decimal Math - Addition 10,000’s1,000’s100’s10’s1’s 1 6 5 1 0 + 1 6 5 9 5 ----------------------------- 1 1 1 3 3 1 0 5 Rick Graziani graziani@cabrillo.edu

  47. Binary Math - Addition 64’s32’s16’s8’s4’s2’s1’s 1 1 1 0 1 0 + 1 1 0 1 1 ----------------------------- Dec 1 1 1 1 58 + 27 ----- 1 0 1 0 1 0 1 85 Double check using Decimal. Rick Graziani graziani@cabrillo.edu

  48. Half Adder Gate – Adding two bits Inputs: A, B S = Sum C = Carry XOR AND A + B = 2’s1’s Rick Graziani graziani@cabrillo.edu

  49. Half Adder Gate – Adding two bits Inputs: A, B S = Sum C = Carry XOR 0 0 0 0 AND C S 0 + 0 ---- A + B = 2’s1’s 0 0 = 0 0 0 Rick Graziani graziani@cabrillo.edu

  50. Half Adder Gate – Adding two bits Inputs: A, B S = Sum C = Carry XOR 0 1 1 0 AND C S 0 + 1 ---- A + B = 2’s1’s 0 1 = 0 1 1 Rick Graziani graziani@cabrillo.edu

More Related