0% found this document useful (0 votes)
4 views4 pages

Final - Spring 2021 NS

The document is a final exam for the CPEN 212 course at the University of Balamand, focusing on electrical and computer engineering. It includes three problems related to finite state machine (FSM) design for pattern generation, a parking lot controller, and a DC motor controller, with specific requirements for each problem. The exam is closed-book, has a total of 50 points, and emphasizes showing work and organization.

Uploaded by

Yehya Youssef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Final - Spring 2021 NS

The document is a final exam for the CPEN 212 course at the University of Balamand, focusing on electrical and computer engineering. It includes three problems related to finite state machine (FSM) design for pattern generation, a parking lot controller, and a DC motor controller, with specific requirements for each problem. The exam is closed-book, has a total of 50 points, and emphasizes showing work and organization.

Uploaded by

Yehya Youssef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

University of Balamand

Faculty of Engineering
Departments of Electrical and Computer Engineering

CPEN 212 R.C. Ayoubi


Spring 2021

Final Exam

Name:__________________________________________________________________

ID number:______________________________________________________________

This is a closed-book, closed-note exam. No calculators please. You have 1 hour and 40
minutes. Each question is marked with its number of points.

Show your work. Write neatly and be well organized.


Good luck!

problem maximum score


1 20pts
2 15pts
3 15pts
total 50pts
Problem 1: Pattern Generation (20 points)
Consider the design of an FSM based on the following specifications. The FSM has one input, X, and
one output, Z. As long the input X is low, the output Z is low. Whenever X goes from low to high, the
output Z should generate ONE PULSE for TWO CLOCK PERIODS (see figure below). Assume
that when X goes high, it is guaranteed to stay high for many clock periods. Similarly, when X goes to
low, it is also guaranteed to stay low for many clock periods. The figure below shows a sample of the
outputs based on MOORE machines. Assume that X is synchronized with the clock (you may think of
it as follows: there is an active-high push-button “ENTER” input, which is the input to a D flip-flop,
and X is the output of that D flip-flop and input to our FSM). In other words, the input X goes high just
right after the rising clock edge (i.e. after clock-to-Q), and it goes back low similarly. So, you do not
have to worry about synchronizing X.

Clk

Z (MOORE)
a) (10 points) Draw the state diagram using MOORE machine.

b) (6 points) Write down the state table and generate the equations.

c) (4 points) Implement the design using D-type flip-flops and combinational logic.

Problem 2: Parking Lot Controller (15 points)


(Note: In this problem, you are asked to design a simplified version of the controller
designed in the project for a parking lot entry. So do not panic! It is really a much simpler
version of the project design. Below in BOLD is a list of the modifications to the original
project design. So please read the BOLD BULLETS below carefully. Before
attempting to solve this problem, read the complete question carefully. You may
also read Problem 3 as well since it is related to this problem.)
The entrance to the parking is controlled by a barrier gate arm protected by a
password. At the entry, the barrier arm is in the down position, which requires the driver
to enter a password prior to the gate arm opening. We are going to assume the following
simplifications:
 No alarm signal is required. Assume that no vehicle will enter illegally.
 If a vehicle is at the gate, after entering the password, it will proceed in
or it may back up. However, no other vehicle can approach the gate
until the first vehicle is either fully in or backed up. After this, another
vehicle may approach the gate (this is really a great simplification to the
design).
The following modification is not really a simplification; rather, it is another way of
transmitting the command to the motor control FSM to open or close the arm.
 Instead of using two output signals, CF and CB, as done in the project,
only one output bit, COM, is used to send commands to the motor
control FSM to open or close the arm. This is elaborated more in the last
paragraph of this problem.

2
This FSM is responsible for detecting the presence of a vehicle at the entry and is
waiting for the pulse from the password FSM. Assume that the password FSM is
already designed and is generating the “correct” pulse. The main job of this FSM is to
send commands to the motor control FSM to open or close the arm and the motor control
FSM will generate the actual signals for controlling the motor driving the arm (you are
asked to design the motor control FSM in Problem 3).
So, this FSM goes like this. There are two sensors installed: S1, S2. S1 is just before
the arm to detect the presence of the vehicle. S2 is installed right at the barrier arm to
detect the presence of any object under the arm so that the arm will not close on it.
Assume that both sensors are active-low. This means that when no car is
detected, S1, S2=11. When a car is detected on S1, then S1=0 (active-low). Similarly,
when a car is detected on S2 (a car is going in), S2=0.
In this simplified version, assuming a car is present at the gate and a correct
password was entered, only two scenarios are possible: The first scenario would be as
follows (remember sensors are active-low): S1, S2= 01 (car is on sensor S1), then 00 (car
is on both sensors), then 10 (car is on S2), and finally 11 when the car is fully inside. This
scenario represents a car at the entry, then keep moving forward until it is fully inside.
The second scenario is: S1, S2=01, then 11. In this case, this can be interpreted as a car
was present, entered a correct password, but then it decided to back up. In both scenarios,
after the correct password was entered, the arm would be given a command to open; then,
when S1, S2 become 11, this FSM should send a signal to close the arm. Only after S1,
S2 becomes 11, a new car can proceed to the gate (this is the simplification explained
above in bold). Also assume that a newly arrived car will never enter the parking
without a correct password even if the gate is not fully closed; therefore, there is no
need for “alarm” signal (of course, this is not realistic in the real world but we will
assume this simplification here).
The output of this FSM should be one bit, COM, which is input to the motor
control FSM that you are asked to design in Problem 3. The machine should operate as
follows. Whenever this FSM needs to open the arm, it generates COM = 1 for TWO
clock periods. If this machine needs to close the arm, it generates COM = 1 for ONE
clock period.
 Draw the state diagram for this controller using Mealy machine.

Problem 3: DC Motor Controller (15 points)


A finite state machine is to be designed to control the movement of a parking arm.
Your inputs include two signals, SWH and SWV, corresponding to two mechanical
switches, which indicate the position of the arm. For instance, if SWH, SWV = 10,
then the arm is in the horizontal position (i.e. the gate is closed). If SWH, SWV = 01,
then the arm is in the vertical position (i.e. the gate is open). If SWH, SWV = 00, then
the arm is in between (i.e. the gate is opening or closing). Assume that SWH, SWV =
11 cannot occur. So you can ignore it. outputs, GoF and GoB, are available to give
command to the DC motor driving the arm to go either in the forward or backward
position according to the following table:

3
GoF GoB Action
0 0 Arm is not moving
1 0 Arm is opening
0 1 Arm is closing
1 1 Not valid output

One additional input, COM, is needed to drive our FSM. Assume that COM is
generated by the master state machine designed in Problem 2 that controls our state
machine (i.e. output from master; inputs to our state machine). The machine should
operate as follows. Whenever the master machine needs to open the arm, it generates
COM = 1 for TWO clock periods. If the master machine needs to close the arm, it
generates COM = 1 for ONE clock period.

 Draw a state diagram for the above problem using Moore machine.

Hint: The command to open or close the arm is controlled by the width of the pulse
on COM signal, instead of CF and CB signals used in the project. So, as soon as you
detect COM=1, you should go to a new state. From that state you should check COM
one more time and based on the new value of COM, you will detect if it is a closing
or opening command and act accordingly.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy