# The SR Flip-Flop – Practical Introduction

This post is used for discussion in class.

## In class demonstration

Teacher draws a SR latch using NOR gates  with top gate as g1 and bottom gate as g2. Teacher draws a truth table for quick reference:

• Scenario, Circuit Startup S=0, R=0 , Q=0  (Q’ is irrelevant and can be proven in a later scenario)
• Input G2 becomes 0,
• Q’ becomes 1
•  Input G1 becomes 1
• Q stays at 0 , circuit is stable in a consistent state.

• Scenario: circuit in previous state, S becomes 1, r stays at 0, Q was 0 and Q’ is 1

• Scenario: Same as previous state,  however S returns to 0.
(Memory is Achieved)

• Same as previous State, but R is set to 1

• Same as previous state but R returns to 0

• CHAOS!!! S and R set to 1.

### Media Attrbution

`No machine-readable author provided. Arturo Urquizo assumed (based on copyright claims)., CC BY 3.0 <https://creativecommons.org/licenses/by/3.0>, via Wikimedia Commons`

# Logic Gates – Formal Introduction

In the previous example we used statements as propositions.  Computer logic is accomplished by using logic gates as building blocks.  A logic gate is a physical circuit which has electrical inputs and usually a single output.

Used in truth tables, we label each input and use truth values to represent weather or not an input is on or off.

We use the value true , T , 1 to represent on and false , F , 0 to represent off.

Sometimes, On is refered to as a high voltage and off is referred to as a low or no voltage.

The most common gates are shown in the table below:

 Gate AND OR NOT NAND NOR XOR Symbol      Inputs A B Q=AB Q=A+B Q = A Q= AB Q=   A+B Q= A ⊕ B 0 0 0 0 1 1 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 1 1 1 1 0 0 0 Description Outputs 1 when all inputs are 1 Outputs 1 when ANY input is a 1 Inverts the input Outputs 0 where all inputs are 1 Outputs 1 then both inputs are 0 Outputs 1 when exactly one input is 1 Outputs 0 otherwise Outputs 0 otherwise Outputs 1 otherwise Outputs 0 otherwise Outputs 0 otherwise

Typing the mathematical notation into most word processors can be challenging. Sometimes these worded expressions or symbols are used :

# Logic Gates

Logic gates are electronic combinational circuits which contain one or more electrical inputs and usually one output.

A combinational circuit’s output depends on the state of it’s inputs.

We use truth tables to document the  behaviour of a logic gates.

## In class demonstration

Demonstrate an AND gate and describe with a truth table and in words

(Teacher constructs the truth table from description for a 2 input and a 3 input gate)

An AND gate’s  output is true only when both inputs are true”

## Homework/In class exercise

Draw the truth table for  the following gates

1. AND
2. OR
3. NOT
4. ExOR
5. NAND

Describe their outputs or mode of operation using a well formed sentence in English. E.g “An AND gate’s  output is true only when both inputs are true”