Security Code Logic
Security Code Logic
OUTPUTS
1- Green LED (Correct Code Indicator):
Lights up when the entered password matches the key code.
2- Red LED (Incorrect Code Indicator):
Lights up when the entered password does not match the key code.
COMPONENTS:
1- XOR Gates:
Compares each bit of the key code with the corresponding data entry bit.
Outputs 1 if the inputs differ, 0 if they match.
2- AND Gates:
Combines outputs of XOR gates to verify that all bits match.
Outputs 1 only when all inputs are 1.
3- NOT Gate:
Inverts the output of the final AND gate to drive the red LED.
Outputs 1 when the AND gate outputs 0.
4- LEDs:
Haneen Khaled 231027213 Areeg Heiba 231027571 Nada Mokhtar 231027044
5- Resistors:
Limit the current through the LEDs to prevent damage.
Truth Table:
Key_ Key_ Key_ Key_ Pass_ Pass_ Data Data XOR XOR XOR XOR
1 2 3 4 1 2 3 4 1 2 3 4
0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 0 0 0 0
1 0 1 0 1 0 0 0 0 0 1 1
1 1 0 1 1 0 0 1 0 1 1 0
AND1 AND2 Final AND Green LED NOT Gate Red LED
1 1 1 ON 0 OFF
1 1 1 ON 0 OFF
0 0 0 OFF 1 ON
0 0 0 OFF 1 ON
CIRCUIT DIAGRAM:
PIN DIAGRAMS:
1- XOR gates:
Haneen Khaled 231027213 Areeg Heiba 231027571 Nada Mokhtar 231027044
2- AND gates:
3- NOT gates:
Haneen Khaled 231027213 Areeg Heiba 231027571 Nada Mokhtar 231027044
HARDWARE IMPLEMNTATION:
Connect the VCC (5V) pin of each IC to the power rail on the breadboard.
Connect the GND (Ground) pin of each IC to the ground rail on the
breadboard.
Attach the first DIP switch to represent the Key Code:
Connect each switch terminal to the inputs labeled Key_1, Key_2, Key_3,
Key_4.
Attach the second DIP switch to represent the Data Entry:
Connect each switch terminal to the inputs labeled Pass_1, Pass_2, Pass_3,
Pass_4.
Connect the other terminal of each switch to the ground through a resistor.
For each pair of inputs (Key1/Data1, Key2/Data2, etc.):
Wire the inputs to the XOR gate on the 74LS86.
Connect the outputs of the XOR gates to the inputs of the first layer of AND
gates.
Combine XOR outputs in pairs.
The first XOR output and the second XOR output as an input for the first
AND gate.
The third XOR output and the fourth XOR output as an input for the second
AND gate.
Connect the outputs of the first AND gate and the second AND gate to the
inputs of a third AND gate.
This final AND gate output determines the output of the code.
Connect the output of AND3 to the anode of the green LED.
Use a resistor between the LED cathode and ground.
Connect the output of the third AND gate to the input of a NOT gate.
Connect the NOT gate output to the anode of the red LED.
Haneen Khaled 231027213 Areeg Heiba 231027571 Nada Mokhtar 231027044