Group11 Sec03

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Project Report

Course Code: CSE331


Course Name: Microprocessor Interfacing and Embedded System
Section: 03
Semester: Summer 2023

Group No. 11
Member:
1. Mohammed Hasib Junayed Ilham – 2013729042
[Single Member]

Email: [email protected]
Page | 1
Contents:
1. General Description……………………………………….……3
1.1. Arduino UNO………………………………………….……3
1.2. Arduino IDE…………………………………………….…..3
1.3. Proteus 8 Pro………………………………….……………3
1.4. Logisim……………………………………….……………..4

2. Equipment……………………………………………………….4

3. Method of derivation……………………………………………5
3.1. Truth Table………………………………………………….5
3.2. Derived Results……………………………………………7

4. Circuit Diagram with Values of Electrical Components……..7

5. Circuit Operation Principles……………………………………8

6. Program Flow Chart…………………………………………...10

7. Arduino Program……………………………………………….11

8. Question & Answers…………………………………………..13

9. Hardware Implementation…………………………………….14

Page | 2
1. General Description

1.1 Arduino UNO


The Arduino UNO is a popular open-source microcontroller board
based on the ATmega328P microcontroller. It features digital and
analog input/output pins, a USB interface for programming and
power supply, and is widely used for developing a wide range of
electronic projects. The Arduino UNO is known for its ease of use,
flexibility, and a large community of makers and developers. It's an
excellent platform for both beginners and experienced engineers
to create interactive and programmable devices.

1.2 Arduino IDE


The Arduino IDE is a software application used for writing,
compiling, and uploading code to Arduino boards like the Arduino
UNO. It provides a user-friendly environment with a simple
programming language and libraries that enable developers to
create software to control hardware. The Arduino IDE is open-
source and cross-platform, making it accessible to a broad
audience of hobbyists, students, and professionals. It simplifies
the process of developing embedded systems and Internet of
Things (IoT) projects.

1.3 Proteus 8 Pro


Proteus 8 Pro is a professional electronic design automation
(EDA) software developed by Labcenter Electronics. It is primarily
used for simulating, designing, and testing electronic circuits.
Proteus offers a comprehensive suite of tools for creating and
simulating schematics, designing printed circuit boards (PCBs),
and emulating microcontroller behavior. Proteus is particularly
valuable for testing and validating electronic designs before they
are physically implemented, reducing development time and costs.
It is widely used in the electronics industry and education.

Page | 3
1.4 Logisim
Logisim is an open-source educational tool used for designing and
simulating digital logic circuits. It provides an intuitive graphical
interface that allows users to create, edit, and simulate digital
circuits with ease. Logisim is commonly used in educational
settings to teach digital logic design concepts such as
combinational and sequential circuits. It offers features for testing
and verifying the behavior of complex digital circuits, making it a
valuable tool for both students and hobbyists interested in digital
electronics. Logisim is a great platform for gaining practical
experience in digital logic design and simulation.

2. Equipment
• Arduino UNO board
• Single pole, double throw (SPDT) switches (4)
• LEDs (4)
• Current limiting resistors for LEDs (4)
• Breadboard and jumper wires

Page | 4
3. Method of Derivation

3.1 Truth Table


Output 3:

Output 2:

Page | 5
Output 1:

Output 0:

Page | 6
3.2 Derived Result
Output 3:

Output 2:

Output 1:

Output 0:

4. Circuit Diagram with Values of Electrical


Components

Page | 7
5. Circuit Operation Principles

The circuit designed for this project is an implementation of a digital logic operation that
takes four binary inputs (I3, I2, I1, and I0) and produces four binary outputs (O3, O2,
O1, and O0). The purpose of this circuit is to evaluate specific logical expressions
based on the input values and provide corresponding output values according to these
expressions.

Input Configuration:
The input pins are defined in the code as follows:

I3: Connected to digital pin 2


I2: Connected to digital pin 3
I1: Connected to digital pin 4
I0: Connected to digital pin 5

These input pins are configured as INPUT_PULLUP, which means that when the
switches are in the OFF position, the input pins are pulled HIGH due to the internal pull-
up resistors of the Arduino. When the switches are ON, the input pins are pulled LOW.

Output Configuration:
The output pins are defined in the code as follows:

O3: Connected to digital pin 6


O2: Connected to digital pin 7
O1: Connected to digital pin 8
O0: Connected to digital pin 9

These output pins are configured as OUTPUT and are used to control the
corresponding LEDs that represent the output values.

Page | 8
Operation:

The core operation of this circuit is based on a set of logical expressions defined in the
code. These expressions determine the output values (O3, O2, O1, O0) based on the
input values (I3, I2, I1, I0). The logical expressions are as follows:

O3: (I0 || !I2 || I3) && (I0 || !I1 || !I3) && (!I1 || I2 || !I3) && (!I0 || I2 || !I3)
O2: (!I1 || I2) && (!I2 || !I3) && (!I0 || !I3)
O1: (I0 || !I1 || I2 || !I3) && (I1 || I2 || I3) && (!I0 || I1 || I3) && (!I0 || !I2 || !I3)
O0: (I0 || I1 || !I3) && (I0 || !I1 || I3) && (!I0 || I1 || I3) && (!I0 || !I1 || !I2) && (!I2 || I3)

The Arduino board reads the input values from the switches connected to the input pins
and evaluates these expressions to compute the output values. The output values are
then applied to the output pins to control the corresponding LEDs. The logic
expressions are designed to encrypt the input data as per the provided encryption table.

The execution time of the logic evaluation is measured, and the results are displayed
via the serial monitor for monitoring purposes. A delay is added to control the update
rate of the outputs.

In summary, this circuit demonstrates a digital logic operation based on specific logical
expressions, and it serves as an example of how an Arduino microcontroller can be
used to implement such logic. The output LEDs visually represent the result of the
logical encryption process.

Page | 9
6. Program Flow Chart

Start

Setup:
- Initialize serial communication at 9600 baud
- Set pins 2, 3, 4, and 5 as INPUT_PULLUP
- Set pins 6, 7, 8, and 9 as OUTPUT

Loop:
- Record the start time using millis()
- Read input values from pins 2, 3, 4, and 5 into inputs array
- Calculate O3 using a complex logic expression
- Calculate O2 using a logic expression
- Calculate O1 using a logic expression
- Calculate O0 using a logic expression
- Set pins 6, 7, 8, and 9 based on O3, O2, O1, and O0 values
- Record the end time using millis()
- Calculate the execution time as the difference between end time and start
time
- Print "Execution Time (ms): " followed by the executionTime
- Add a 1-second delay using delay(1000)
Repeat Loop

End

Page | 10
7. Arduino Program

// Define input pins


const int inputPins[] = {2, 3, 4, 5};

// Define output pins


const int outputPins[] = {6, 7, 8, 9};

void setup() {
// Initialize serial communication
Serial.begin(9600);

// Set input pins


for (int i = 0; i < 4; i++) {
pinMode(inputPins[i], INPUT_PULLUP);
}

// Set output pins


for (int i = 0; i < 4; i++) {
pinMode(outputPins[i], OUTPUT);
}
}

void loop() {
// Record the start time
unsigned long startTime = millis();

// Read input values


int inputs[4];
for (int i = 0; i < 4; i++) {
inputs[i] = digitalRead(inputPins[i]);
}

// Calculate output values based on logic expression


int O3 = (inputs[0] || !inputs[2] || inputs[3]) && (inputs[0] || !inputs[1] ||
!inputs[3]) && (!inputs[1] || inputs[2] || !inputs[3]) && (!inputs[0] || inputs[2] ||
!inputs[3]);
int O2 = (!inputs[1] || inputs[2]) && (!inputs[2] || !inputs[3]) && (!inputs[0] ||
!inputs[3]);
int O1 = (inputs[0] || !inputs[1] || inputs[2] || !inputs[3]) && (inputs[1] ||
inputs[2] || inputs[3]) && (!inputs[0] || inputs[1] || inputs[3]) && (!inputs[0] ||
!inputs[2] || !inputs[3]);

Page | 11
int O0 = (inputs[0] || inputs[1] || !inputs[3]) && (inputs[0] || !inputs[1] ||
inputs[3]) && (!inputs[0] || inputs[1] || inputs[3]) && (!inputs[0] || !inputs[1] ||
!inputs[2]) && (!inputs[2] || inputs[3]);

// Set output pins


digitalWrite(outputPins[0], O3);
digitalWrite(outputPins[1], O2);
digitalWrite(outputPins[2], O1);
digitalWrite(outputPins[3], O0);

// Record the end time


unsigned long endTime = millis();

// Calculate and print the execution time


unsigned long executionTime = endTime - startTime;
Serial.println("Execution Time (ms): " + String(executionTime));

// Add a delay if needed to control the update rate


delay(1000); // Add a 1-second delay to control the update rate
}

Page | 12
8. Question & Answers

-what is the clock frequency of the microcontroller used?


16MHz

- what is the data bus width of the microcontroller used?


8Bits

- what is the size of your hex file generated? Attach the hex codes to
your report.

sketch_oct29a.ino.h
ex
12KB

-Can the project be implemented by using interrupt?


Yes

-Is the main routine required to be an infinite loop? provide


explanation in favor of your answer
In the context of microcontroller programming, particularly with platforms like Arduino, it
is common and often recommended to have a main routine that runs as an infinite loop.
Here are some reasons in favor of using an infinite loop in the main routine:
Continuous Operation
Real-Time Responsiveness
Predictable Behavior
Resource Management
Event-Driven Systems
Ease of Development

Page | 13
- Is there any difference between level triggered and edge triggered
operation for the given project?
Yes, there is a significant difference between level-triggered and edge-
triggered operation, and the choice between them can affect how your
project functions, especially when dealing with input changes and
interrupts.

-Is the project referring to encryption or decryption from input to


output?
Encryption

9. Hardware Implementation

https://drive.google.com/file/d/1XmxcuCDOw7-
fJNZjdAZi5I0fkUhJJSDi/view?usp=sharing

Page | 14

You might also like