16
CS 250 Lab 2 W 9:30 - 11:20 Wednesday, September 4, 13

CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

CS 250 Lab 2 W 9:30 - 11:20

Wednesday, September 4, 13

Page 2: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Today’s Plan...• First 15 minutes: Lab 1 grading

• Roughly 20 minutes on explaining Lab2

• Distributing Lab2 Grading forms

• [Process 1]Grade Lab 1 for those who come late...

• [Process 2]Start working on lab 2 In-lab Assignment

• Last 15 minutes: Grading lab2 In-lab assignment

• Courses.cs.purdue.edu

Wednesday, September 4, 13

Page 3: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Lab 2 Prerequisites

• Know what is logic gates.

• Understand boolean algebra laws.

• Understand what is flip-flop and how it works.

Wednesday, September 4, 13

Page 4: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Part 1 Logic Gates(Review)• A logic gate is an idealized or physical device

implementing a Boolean function, that is, it performs a logical operation on one or more logical inputs, and produces a single logical output. (From Wikipedia)

Ph.D Program

Input(s) Output

CS Logic Gate

Wednesday, September 4, 13

Page 5: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Common Logic Gates

• NAND Gate

• NOR Gate

• Inverter (NOT Gate)

• Check the truth table of the above gates.

• Although AND and OR gates are more human-friendly, NAND gates and NOR gates are more commonly used in real life.

• We use less transistor if we use NAND and NOR gates. (Save money and energy)

Wednesday, September 4, 13

Page 6: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Truth Table

Wednesday, September 4, 13

Page 7: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

More Truth Table

Wednesday, September 4, 13

Page 8: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Part 2 Boolean Algebra

• Commutative Law: AB = BA A+B = B+A

• Associative Law: (A+B)+C = A+(B+C)

• Distributive Law: A(B+C) = AB+AC

• De Morgan’s Law:(A+B)’ = A’B’(AB)’ = A’+B’

Wednesday, September 4, 13

Page 9: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Magic NAND Gates

• We can construct any gates with enough NAND gates.

• Use Boolean Algebra to convert any logic gates to NAND gates.

Wednesday, September 4, 13

Page 10: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Part 3 Flip - Flop

• In order for computers and other electronic devices to be practical, it is very useful to have some means of saving the current state of their circuit. The most basic implementation of a state-saving circuit is known as a flip-flop (also known as a latch ).

Wednesday, September 4, 13

Page 11: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

How Flip-Flop Works?

• The Flip-flop works because there is a time delay in circuit. The electric signal need a small amount of time to travel from a gate to another. Electrons travel at the speed of light in the circuit.This mechanism is called “feedback circuit”, which enables the Flip-flop to maintain a certain state.

Wednesday, September 4, 13

Page 12: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Example... • SR Flip-Flop

Wednesday, September 4, 13

Page 13: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Part 4 RGB LED...

• I broke two RGB LED last semester...

• It is extremely important to connect the RGB LED with Resistors.

• The RGB LED cost me only about $1, but shipping cost me $15......

Wednesday, September 4, 13

Page 14: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

More RGB LED• An RGB LED isn't a single LED, it's

actually three LEDs in one small package: one red, one green and one blue. Turning more than one of these LEDs on at once mixes their light together, yielding different colors. The final color you get is a result of the intensity of the individual red, green and blue LEDs.

Wednesday, September 4, 13

Page 15: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Wednesday, September 4, 13

Page 16: CS 250 Lab 2zhan1015/Academy/CS 250/Lab 2.pdf · Today’s Plan... • First 15 minutes: Lab 1 grading • Roughly 20 minutes on explaining Lab2 • Distributing Lab2 Grading forms

Time for In-Lab Assignment...

• Handout can be found on Course Website.

• If you come late and didn’t get your lab1 graded. We will grade your works now. :-)

• Distributing Lab2 Grading Forms.

• Have fun on Circuit, NOT FACEBOOK.

• If you finish early, you can either leave or stay.

Wednesday, September 4, 13