Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CEG-ANNA UNIVERSITY

MINI PROJECT ON BOOLEAN CALCLATOR

STUDENT NAME : GOKULAKANNAN T(2022103708)


FIDA HUSSAIN A (2022103709)
DEGREE : B.E
SEMESTER : 3
BATCH : P
SUBJECT CODE : CS6105
SUBJECT NAME : DIGITAL FUNDAMENTALS AND COMPUTER
ORGANIZATION
SUBMITTED ON : 19.12.2023

1
OBJECTIVE:
The objective of a boolean calculator is to perform logical operations on boolean values. This
includes operations such as AND, OR, NOT, XOR, and NAND. The calculator allows users to input
boolean values and perform these logical operations to obtain the desired result. It is a useful tool for
evaluating boolean expressions and solving logical problems.

DESCRIPTION:
 A boolean calculator is a specialized tool designed to perform logical operations on boolean values.
It allows users to input boolean variables or expressions and then apply logical operations such as
AND, OR, NOT, XOR, and NAND to manipulate and analyze the boolean values.

 The calculator typically provides a user-friendly interface where users can input boolean values and
select the desired logical operation to be performed.

 The boolean calculator is particularly useful in fields such as computer science, digital logic design,
and mathematics, where boolean algebra and logic gates are widely used. It enables users to evaluate
complex boolean expressions and verify the correctness of logical operations.

 Overall, a boolean calculator serves as a valuable tool for performing logical operations on boolean
values, aiding in problem-solving, decision-making, and understanding of boolean algebra.

COMPONENTS REQURIMENTS:
 PCB BOARD
 ARDUINO NANO
 LCD DISPLAY
 NUMBER PAD
 CONNECTING WIRES
 HW BATTERY

2
CIRCUIT DIAGRAM:

Block Diagram Description:


Above figure shows the basic block diagram of the project. Now let us discuss all the blocks in detail:

Power Supply: It can be defined as a device that supplies electrical energy to one or more electric loads. The
term is most commonly applied to devices that convert one form of electrical energy to another, though it
may also refer to devices that convert another form of energy (e.g., mechanical, chemical, solar) to electrical
energy. In our project a supply mains that is 5volt d.C. is given to the microcontroller, LED’s , keypad,
display.
Microcontroller: Microcontroller ATMEGA 16L is used for the automation purpose and acts as brain of the
project. It controls the output (Display) according to the input given to it. Read the post: Microcontroller
Basics to get basic knowledge about microcontrollers.
Display: The Display used here is 3 Bi-color LED’s. The Glowing Pattern of LED’s represent the desired
minimized expression.
Keypad: In this project series of switches have been used as keypad, is used to give the input (min-terms)
expression. Each digit on the keypad corresponds to one min-term each.
CODE:
#include <Keypad.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);

const byte ROWS = 4;


const byte COLS = 4;

char keys [ROWS] [COLS] = {


3
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {12,11,10,9};
byte colPins[COLS] = {8,7,6,5};

Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

boolean presentValue = false;


boolean next = false;
boolean final = false;
String num1, num2;
int answer;
char op;

void setup()
{
Serial.begin(9600);

lcd.init();
lcd.backlight();

lcd.setCursor(0,0);
lcd.print(" Arduino Based ");
lcd.setCursor(0,1);
lcd.print(" Calculator ");
delay(3000);
lcd.clear();
}

4
void loop(){

char key = myKeypad.getKey();


Serial.println(key);

if (key != NO_KEY && (key=='1'||key=='2'||key=='3'||key=='4'||key=='5'||key=='6'||


key=='7'||key=='8'||key=='9'||key=='0'))
{
if (presentValue != true)
{
num1 = num1 + key;
int numLength = num1.length();
lcd.setCursor(15 - numLength, 0); //to adjust one whitespace for operator
lcd.print(num1);
}
else
{
num2 = num2 + key;
int numLength = num2.length();
lcd.setCursor(15 - numLength, 1);
lcd.print(num2);
final = true;
}
}

else if (presentValue == false && key != NO_KEY && (key == 'A' || key == 'B' || key ==
'C' || key == 'D'))
{
if (presentValue == false)
{
presentValue = true;
op = key;
5
lcd.setCursor(15,0);
lcd.print(op);
}
}

else if (final == true && key != NO_KEY && key == '#'){


if (op == 'A'){
answer = num1.toInt() + num2.toInt();
}
else if (op == 'B'){
answer = num1.toInt() - num2.toInt();
}
else if (op == 'C'){
answer = num1.toInt() * num2.toInt();
}
else if (op == 'D'){
answer = num1.toInt() / num2.toInt();
}
lcd.clear();
lcd.setCursor(15,0);
lcd.autoscroll();
lcd.print(answer);
lcd.noAutoscroll();
}
else if (key != NO_KEY && key == '*'){
lcd.clear();
presentValue = false;
final = false;
num1 = "";
num2 = "";
answer = 0;

6
op = ' ';
}
}
CONCLUSION:

A boolean calculator is a valuable tool for anyone working with boolean algebra, digital logic
design, or logical operations. It provides a user-friendly interface for inputting boolean values and
performing logical operations such as AND, OR, NOT, XOR, and NAND. The calculator’s ability to handle
complex boolean expressions, generate truth tables, simplify expressions, and visualize logical circuits
makes it an essential tool for educators, students, and professionals. By aiding in problem-solving, decision-
making, and understanding of boolean logic, the boolean calculator plays a crucial role in various fields,
including computer science, mathematics, and engineering. Its versatility and functionality make it an
indispensable resource for anyone dealing with boolean values and logical operations.

You might also like