# CECS 346 Lab 3 Moore Finite State Machine solution

\$30.00

Original Work ?
Category:

## Preparation:

YoƵ ǁill need a LaƵnchPad͕ ƚǁo pƵƐh bƵƚƚonƐ oƌ ƐǁiƚcheƐ͕ ƚǁo ϭϬkё ƌeƐiƐƚoƌƐ͕ four color LEDs:
red, yellow, green, and white, and four resistors for the LEDs (between ϯϯϬё ƚo ϭkёͿ͘
Book Reading: Textbook Sections 2.7, 4.2, 6.5
Starter project: SimpleTrafficLight

## Purpose:

The purpose of this lab is to implement a Moore finite state machine and use switches to
control the state transitions.

## System Requirements:

In this lab, you will build two switch interfaces that implement positive logic, and three LED interfaces
that implement positive logic. You will attach these switches and LEDs to your breadboard and interface

## Hardware requirements:

1) Port E will be used to control 4 LEDs: white(PE3), red (PE2), yellow (PE1), green (PE0).
2) Port A will be used for the two switches: sw1 (PA2), sw2 (PA3)

## Software Requirements:

You must implement the logic in this lab as a Moore finite state machine (FSM). Try to
minimize number of states. Use software loop to implement the delay.

1) The system starts with the green LED on, the other three LEDs off. The three color LEDs
aligned in the following order greenoyellowored. At any time, green LED and white LED
should not be turned on at the same time.
2) Wait 2s, then check the two switches.
3) Case1: green LED is on:
a. If sw2 is not pressed, stay in green and go back to step 2).
b. If sw2 is pressed, color LED will switch to yellow for 1s, then the color LED goes to red and
white LED will be on.
4) Case 2: white LED is on:
a. If sw1 is not pressed, stay in green and go back to step 2).
b. If sw1 is pressed, white LED will blink at a speed of 0.5s on, 0.5s off for 1s, then white LED
will be off, green LED will be on.
5) Repeat steps 2 to 4.

### Deliverable:

1) Demonstrate your lab on board over Zoom.
2) Submit a lab report (This Word Document) including the following items:
b. State table for your Moore FSM
c. State diagram for your Moore FSM
d. Schematic and photo of your hardware system
2
f. Software source code: CECS346Lab3.c.
Gg too tÉ oo 70010
25
X Lotto gotta 0.55 0.55
Stateline egg qt j NII
612s G G Y Y
Y Is RW RW RW RW
RNAs RW R RW R
Ross
RWIRWIRWIRWIRWHO.si G G G G
Moore FSM State Diagram:
Moore FSM State Table:
Schematic:
Hardware System: