Logic gates are the fundamental building blocks of modern computers. This tutorial provides an overview of the logic and computing tools available on Polypad. The topics covered include
- Inputs and Outputs
- Logic Gates
- Memory Devices
Lesson plans for using logic gates for students of all ages are available on the task page. More lessons plans will be added soon!
Inputs and Outputs
The Button and the Switch are input tiles and the light is an output tile. Inputs have a blue triangle on the right side of the tile and outputs have a blue circle on the left side of the tile. Wires connect inputs and outputs. Click and drag the blue triangle to reveal a wire and use it to connect that input to an output.
Wires deliver messages from one tile to another. The message is the value of the wire and each wire has a value of ON (1) or OFF(0). Inputs control the value of the wire and the value of the wire has an impact on the output.
In the video below, the light turns on when the button is clicked or when the switch is turned on. Clicking the button and turning on the switch changes the value in the wire from OFF to ON. An OFF wire keeps the output in an off state.
Multiple wires can come from the same input, but an output can only receive one wire.
Logic gates have blue circles on the left and a blue triangle on the right. So, these gates both receive inputs from one or more wires and produce an output through one wire. Each gate has a specific rule it follows for deciding whether the output wire has a value of ON or OFF.
The or gate produces, or emits, an output of ON if either or both of the input wires are ON.
The and gate emits ON if, and only if, both inputs are ON.
The xor gate emits ON if both inputs are different.
The nand gate emits ON except when both inputs are ON. This gate is the opposite, or complement, of the and gate.
The nor gate emits ON only when both inputs are OFF. This gate is the opposite, or complements, of the “or” gate.
The xnor gate emits ON when both inputs are ON or when both inputs are OFF.
The not gate emits ON when the input is OFF.
The buffer gate emits ON when the input is ON. Buffer gates are often used to organize circuits.
Gates can be combined to create a wide variety of circuits. Some gate-combinations are more frequently used than others. The tiles in the memory category are some of the more commonly used gate-combinations. These pre-made gate combinations are helpful for storing and manipulating the data from the inputs.
SR (Set-Reset) Latch
Like some gates, the SR Latch has two inputs and one output. The top input is the SET input and the bottom input is the RESET input. When the value of the wire connected to the SET input goes from OFF to ON, the SR latch continuously emits an ON output. This continues until the latch is reset. This reset happens by connecting a wire to the RESET input and changing the value of that wire from OFF to ON.
T (Toggle) Flip-flop
The T Flip-flop has one input and one output. The output alternates between ON and OFF separately for each input of ON and OFF. The first OFF input emits an OFF, while the next OFF input emits an ON. These outputs alternate back and forth as the OFF inputs continue. A similar pattern takes place with the ON inputs.
D (Data) Flip-flop
The D Flip-flop has two inputs and one output. The top input is the “data” input. While the bottom input is technically called “clock” input, it is most helpful to think of this input as the “action” input. When the value of the wire connected to the bottom input goes from OFF to ON, the gate emits an output that is the same as the value of the wire connected to the top input. In short, clicking the bottom input creates the action of storing the data coming into the top input (ON or OFF) The gate continuously emits this output until the bottom input changes values again.
The JK flip-flop has three inputs and one output:
Depending upon the value of the J and K input, changing the value of the C input from OFF to ON creates different outputs:
|J Input||K Input||Result on Output of Clicking C|
|ON||ON||Toggle output (light goes on and off in example below)|
|OFF||ON||Output goes to off (light turns off and/or stays off in example below)|
|ON||OFF||Output goes to on (light turns on and/or stays on in example below)|
|OFF||ON||Output stays in its current state|
Below are some sample Polypads of how the tiles above can be used together.