Question.1
A microcontroller must read and store four push-button states at the same instant. Which register should be used?
A register is a group of flip-flops used to store a binary value.
A 2-bit register contains two D flip-flops:
D1 stores the MSB.D0 stores the LSB.Q1 and Q0.Both flip-flops receive the same clock signal.
Fig. 1: 2-bit Register

Working
D1D0 is stored in Q1Q0.Table 1: 2-Bit Register Example
| Condition | D1D0 | Q1Q0 |
|---|---|---|
| Before clock edge | 10 | Previous value |
| At active clock edge | 10 | 10 |
| After clock edge | X | 10 |
X means the input value does not affect the already stored output.
A right shift register moves every stored bit one position toward the LSB.
For a 4-bit register:
Q3 → Q2 → Q1 → Q0Here:
Q3 is the MSB.Q0 is the LSB.Q3.Q0.Fig. 2: 4-bit Right Shift Register

Connections
D3 = Serial InD2 = Q3D1 = Q2D0 = Q1Serial Out = Q0Working
At every active clock edge:
Q3 receives the serial input.Q2 receives the previous Q3.Q1 receives the previous Q2.Q0 receives the previous Q1.Table 2: Right Shift Example
| Present Value | Serial Input | Value After Clock |
|---|---|---|
| 1011 | 0 | 0101 |
The bits move from MSB to LSB.
A left shift register moves every stored bit one position toward the MSB.
For a 4-bit register:
Q0 → Q1 → Q2 → Q3Here:
Q0.Q3.Fig. 3: 4-bit Left Shift Register

Connections
D0 = Serial InD1 = Q0D2 = Q1D3 = Q2Serial Out = Q3Working
At every active clock edge:
Q0 receives the serial input.Q1 receives the previous Q0.Q2 receives the previous Q1.Q3 receives the previous Q2.Table 3: Left Shift Example
| Present Value | Serial Input | Value After Clock |
|---|---|---|
| 1011 | 0 | 0110 |
The bits move from LSB to MSB.
An edge detector produces a short pulse when an input signal changes from one logic level to another.
It uses two clocked samples:
Q0 – current sampled inputQ1 – previous sampled inputThe output pulse normally remains active for one clock cycle.
Table 4: Edge Detector Types
| Rising Edge 0 → 1 | Falling Edge 1 → 0 | |
| Active-HIGH output | ![]() The output becomes 1 for one clock cycle when the input changes from 0 to 1. | ![]() The output becomes 1 for one clock cycle when the input changes from 1 to 0. |
| Active-LOW output | ![]() The output becomes 0 for one clock cycle when the input changes from 0 to 1. | ![]() The output becomes 0 for one clock cycle when the input changes from 1 to 0. |
Applications
A bi-directional shift register can shift data in both directions.
MSB to LSBLSB to MSBA direction input DIR selects the shifting direction.
Fig. 4: 4-bit Bi-directional Shift Register with Two inputs

Circuit Structure
Each flip-flop input is connected to a 2-to-1 multiplexer.
The multiplexer selects:
Two serial inputs are used:
SRin – enters the MSB during right shiftSLin – enters the LSB during left shiftTable 5: Bi-Directional Register Connections
| Flip-Flop Input | DIR = 0 Right Shift | DIR = 1 Left Shift |
|---|---|---|
D3 | SRin | Q2 |
D2 | Q3 | Q1 |
D1 | Q2 | Q0 |
D0 | Q1 | SLin |
Working
When DIR = 0
Q3 toward Q0.SRin.When DIR = 1
Q0 toward Q3.SLin.The selected shift occurs at every active clock edge.
Registers are classified by how data enters and leaves them.
Table 6: Register Type Comparison
| Type | Input Method | Output Method | Main Function |
|---|---|---|---|
| PIPO | Parallel | Parallel | Store a complete binary word |
| SISO | Serial | Serial | Shift or delay serial data |
| SIPO | Serial | Parallel | Convert serial data to parallel |
| PISO | Parallel | Serial | Convert parallel data to serial |
PIPO means Parallel-In Parallel-Out.
All input bits are loaded together, and all output bits are available together.
Fig. 5: Parallel-in Parallel-out Shift Register

Connections
Working
At the active clock edge:
Q3Q2Q1Q0 = P3P2P1P0The complete binary word is stored in one clock operation.
Functionality
SISO means Serial-In Serial-Out.
Data enters one bit at a time and leaves one bit at a time.
Fig. 6: Serial-in Serial-out Shift Register

Connections
Working
At each active clock edge:
For an n-bit SISO register, a bit reaches the output after n clock edges.
Functionality
SIPO means Serial-In Parallel-Out.
Data enters one bit at a time, but all stored bits can be read together.
Fig. 7: Serial-in Parallel-out Shift Register

Connections
Working
Functionality
PISO means Parallel-In Serial-Out.
A complete binary word is loaded together and then shifted out one bit at a time.
Fig. 8: Parallel-in Serial-out Shift Register

Connections
Each flip-flop uses a multiplexer to select:
A LOAD input controls the operation.
Working
When LOAD = 1
All parallel input bits are loaded together:
Q3Q2Q1Q0 = P3P2P1P0When LOAD = 0
The stored data shifts one bit during each clock edge.
For right shifting:
Q0.Q0.Functionality
Parallel data can be transmitted through one serial line using:
PISO → Transmission Line → SIPO
Fig. 9: Parallel to Serial to Parallel Transmission

Working
Table 7: Data Transmission Stages
| Stage | Register or Link | Data Form |
|---|---|---|
| Input | PISO parallel inputs | Parallel |
| Conversion | PISO shifting | Parallel to serial |
| Transfer | Transmission line | Serial |
| Conversion | SIPO shifting | Serial to parallel |
| Output | SIPO parallel outputs | Parallel |
Important Conditions
Benefits
The LED belt uses a 4-bit right shift register to create a moving-light effect.
Each register output is connected to one active-HIGH LED:
Q3 → LED3Q2 → LED2Q1 → LED1Q0 → LED0An active-HIGH output falling-edge detector monitors input IN.
Fig. 10: LED Belt Circuit

Circuit Behaviour
0.LSB.Table 8: LED Belt Example
| Clock Event | Register Output Q3Q2Q1Q0 | Glowing LED |
|---|---|---|
| Falling edge detected | 1000 | LED3 |
| Next clock | 0100 | LED2 |
| Next clock | 0010 | LED1 |
| Next clock | 0001 | LED0 |
Only one HIGH pulse is inserted for one falling edge. Therefore, one LED moves through the belt after each clock.
The digital lock stores a sequence of three button presses and compares it with the correct code:
5 → 1 → 7
Input Section
The circuit contains seven push buttons labelled 1 to 7.
D1 to D7.A, B, C, and D.D is unused.A, B, and C form the 3-bit button code.Button-Press Detection
The signal: A + B + C
becomes HIGH when an encoded button value is present.
This signal is connected to an active-HIGH output rising-edge detector.
When a button is pressed:
Sequence Storage
The circuit uses three 3-bit PIPO registers to store three encoded button values.
The registers store the entered button sequence. The stored values are checked after each entry.
Code Matching
A combinational circuit is connected after each PIPO register.
Each circuit produces HIGH only when its stored 3-bit value matches the required button value:
517The three match signals are combined to generate UNLOCK.
Table 9: Digital Lock Code Check
| Stored Entry | Required Button | Match Output |
| First entry | 5 | HIGH when value is 5 |
| Second entry | 1 | HIGH when value is 1 |
| Third entry | 7 | HIGH when value is 7 |
When all three stored values match:
UNLOCK = 1
Reset Operation
The R push button shifts the code in next register. It works similar to "0".
Complete Working
UNLOCK becomes HIGH only when the entered code is 517.Fig. 11: Digital Lock Circuit using Registers
