lab reportالذويب

You might also like

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

University of Tripoli-faculty of engineering

Department of electrical and electronics

EE561 control and computer lab II

Digital system Design Simulation

Lab report

Name: ‫هديل عادل عبيد‬

ID: 022171912

Supervisor:‫احمد الذويب‬.‫د‬

Date:

Spring 2022
1. Abstract:
This experiment enables us to simulate a digital system designed from a given specifications
using C++ programming language.

2. Design specifications:
It’s required to simulate a design of a logic circuit for a car direction indicator using c++
programming language where the car moves either left, right or direct according to an activation
of one of the three direction lines.

Notes:

 When motion M is 0 directions are 0


 At the beginning car moves direct
 If possible ,avoid any consecutive directions
 Priority is always for left direction
 When M=L=D=R=1 ,priority (direction) is direct

3. Pre-lab questions:
Q1. Write the truth table for the specifications
Q2. Drive the logic equations for the outputs using minimum sum of products form

Using K-maps we drive the equations

Left=MLR’

Direct=MLDR+ML’R’

Right=MD’R+ML’R

Q3.write a code using c++ programming language to check your design

4. Experiment procedure, Result and analysis:

After writing the truth table and using k-maps to find the equations for the outputs, we stated
writing the C++ program to simulate the functionality of the design.

We started by defining all the variables in the code which are the inputs M, L, D, R, and the
outputs Left, direct, and right, the we outputted a message to allow the user to input the values of
M, L, D, and R.
The first if statement was to make sure that if M=0 than the car is not moving (note #1), the next
if statement make sure that the user only used Boolean values for the inputs (0 or 1) and if not
the program will display a massage indicating that the used inputted wrong kind of data.

The first direction we tested was the left because it has priority (note #4) ,therefore when the
equation for Left output is true the rest outputs don’t get tested. Finally we tested for the Direct
and right directions.

5. Conclusion:
In this experiment we simulated the functionality of a car direction indicator using c++
programming language where we used given specifications to write a truth table then dived the
equations for the outputs which we used to write the program.

You might also like