EE 357 Lab 4 Stopwatch

Similar documents
Experiment 7 Fall 2012

CP316 Screencast mini-project

CSCB58 - Lab 4. Prelab /3 Part I (in-lab) /1 Part II (in-lab) /1 Part III (in-lab) /2 TOTAL /8

Laboratory Exercise 7

Main Design Project. The Counter. Introduction. Macros. Procedure

Main Design Project. The Counter. Introduction. Macros. Procedure

EE 101 Lab 7 Crosswalk

Experiment 8 Fall 2012

Marks and Grades Project

EE 209 Lab 7 A Walk-Off

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

Experiment 3: Basic Embedded System Analysis and Design

Lab 17: Building a 4-Digit 7-Segment LED Decoder

HDL & High Level Synthesize (EEET 2035) Laboratory II Sequential Circuits with VHDL: DFF, Counter, TFF and Timer

Laboratory Exercise 4

California State University, Bakersfield Computer & Electrical Engineering & Computer Science ECE 3220: Digital Design with VHDL Laboratory 7

Laboratory Exercise 7

University of Pennsylvania Department of Electrical and Systems Engineering. Digital Design Laboratory. Lab8 Calculator

Digital Logic. ECE 206, Fall 2001: Lab 1. Learning Objectives. The Logic Simulator

Figure 1 Block diagram of a 4-bit binary counter

Lab 2: Hardware/Software Co-design with the Wimp51

Digital (5hz to 500 Khz) Frequency-Meter

EECS 140 Laboratory Exercise 7 PLD Programming

FPGA Laboratory Assignment 4. Due Date: 06/11/2012

Laboratory 11. Required Components: Objectives. Introduction. Digital Displays and Logic (modified from lab text by Alciatore)

USER'S MANUAL. Getting started with ALEXAN ATMEL AT89C2051/AT89C4051 Training Module - 1

ECB DIGITAL ELECTRONICS PROJECT BASED LEARNING PROJECT REPORT ON 7 SEGMENT DIGITAL STOP WATCH USING DECODER

Step 1 - shaft decoder to generate clockwise/anticlockwise signals

Ryerson University Department of Electrical and Computer Engineering COE/BME 328 Digital Systems

Lab #10 Hexadecimal-to-Seven-Segment Decoder, 4-bit Adder-Subtractor and Shift Register. Fall 2017

Copyright 2011 by Enoch Hwang, Ph.D. and Global Specialties. All rights reserved. Printed in Taiwan.

Laboratory 8. Digital Circuits - Counter and LED Display

SWITCH: Microcontroller Touch-switch Design & Test (Part 2)

Design and implementation (in VHDL) of a VGA Display and Light Sensor to run on the Nexys4DDR board Report and Signoff due Week 6 (October 4)

Assignment 2b. ASSIGNMENT 2b. due at the start of class, Wednesday Sept 25.

PHYS 3322 Modern Laboratory Methods I Digital Devices

Mission. Lab Project B

The Micropython Microcontroller

Synchronous Sequential Logic

Review : 2 Release Date : 2019 Last Amendment : 2013 Course Code : SKEE 2742 Procedure Number : PK-UTM-FKE-(0)-10

CPE 200L LABORATORY 3: SEQUENTIAL LOGIC CIRCUITS UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND: SR FLIP-FLOP/LATCH

EE 367 Lab Part 1: Sequential Logic

2. Logic Elements and Logic Array Blocks in the Cyclone III Device Family

ELEC 204 Digital System Design LABORATORY MANUAL

INTRODUCTION (EE2499_Introduction.doc revised 1/1/18)

Digital Clock. Perry Andrews. A Project By. Based on the PIC16F84A Micro controller. Revision C

EEM Digital Systems II

Programmable Logic Design I

Design of a Binary Number Lock (using schematic entry method) 1. Synopsis: 2. Description of the Circuit:

ECE-320 Lab 5: Modeling and Controlling a Pendulum

Logic Analyzer Triggering Techniques to Capture Elusive Problems

Design Problem 4 Solutions

Point System (for instructor and TA use only)

Alice EduPad Board. User s Guide Version /11/2017

Lab experience 1: Introduction to LabView

Pinewood Derby Finish Line Detection System

Laboratory 1 - Introduction to Digital Electronics and Lab Equipment (Logic Analyzers, Digital Oscilloscope, and FPGA-based Labkit)

APPLICATION NOTE 4312 Getting Started with DeepCover Secure Microcontroller (MAXQ1850) EV KIT and the CrossWorks Compiler for the MAXQ30

Ryerson University Department of Electrical and Computer Engineering EES508 Digital Systems

ENGR 40M Project 3b: Programming the LED cube

FPGA-BASED EDUCATIONAL LAB PLATFORM

Rensselaer Polytechnic Institute Computer Hardware Design ECSE Report. Lab Three Xilinx Richards Controller and Logic Analyzer Laboratory

You will be first asked to demonstrate regular operation with default values. You will be asked to reprogram your time values and continue operation

COMPUTER ENGINEERING PROGRAM

Checkpoint 4. Waveform Generator

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

ECE 372 Microcontroller Design

Laboratory 4. Figure 1: Serdes Transceiver

ECE 270 Lab Verification / Evaluation Form. Experiment 9

Preliminary Design Report. Remote Fencing Scoreboard Gator FenceBox

ENGR 1000, Introduction to Engineering Design

CHAPTER 4: Logic Circuits

This document is intended to provide information to allow the researcher to build their own device.

10.1 Sequential logic circuits are a type of logic circuit where the output of the circuit depends not only on

Spring 2011 Microprocessors B Course Project (30% of your course Grade)

Experiment # 4 Counters and Logic Analyzer

CHAPTER 4: Logic Circuits

Lecture 10: Programmable Logic

1. Synopsis: 2. Description of the Circuit:

Alice EduPad for Tiva or MSP432 TI ARM Launchpad. User s Guide Version /23/2017

Vtronix Incorporated. Simon Fraser University Burnaby, BC V5A 1S6 April 19, 1999

Embedded Systems Lab. Dynamic Traffic and Street Lights Controller with Non-Motorized User Detection

Lab #11: Register Files

Embedded Systems. Interfacing PIC with external devices 7-Segment display. Eng. Anis Nazer Second Semester

Implementing a Rudimentary Oscilloscope

Logic Analyzer Auto Run / Stop Channels / trigger / Measuring Tools Axis control panel Status Display

DE2-115/FGPA README. 1. Running the DE2-115 for basic operation. 2. The code/project files. Project Files

Objectives: Learn how LED displays work Be able to output your name on the display

Fig. 1. The Front Panel (Graphical User Interface)

EE 109 Homework 6 State Machine Design Name: Score:

Lab 13: FPGA Circuit Realization Ian Callahan

Lecture #4: Clocking in Synchronous Circuits

LCD STIMULUS DISPLAY for ENV-007/008 CHAMBERS

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 2200

STB Front Panel User s Guide

Edge Connector Light Level Detector

New GRABLINK Frame Grabbers

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

Dynamic Animation Cube Group 1 Joseph Clark Michael Alberts Isaiah Walker Arnold Li

Laboratory Exercise 6

Transcription:

EE 357 Lab 4 Stopwatch 1 Introduction You will work in teams of one or two to write C code for your Coldfire board to implement the functionality of a stopwatch. You will plug your microcontroller board into the Tower system along with a pre-built protoboard with 3 sevensegment displays. This project, though well-defined, will not provide a large amount of pre-written code. It will be up to your creative and design abilities to complete the project. 2 What you will learn This lab will help you integrate the embedded coding concepts and different I/O functionality into a single project. You will need to integrate the concepts of timers, polling and GP I/O to arrive at a working solution. You may pull in code from the basic demo lab/projects that we performed earlier. 3 Background Information and Notes Stopwatch Application This project will implement a stopwatch application that counts upwards in increments of tenths of seconds from 00.0 to 59.9 seconds. It will provide the ability to start, stop, and reset (back to 00.0) the stopwatch. It should also implement a lap feature which freezes the displayed time at the instant the lap button is pressed while still keeping the internal watch time incrementing. When lap is toggled again (or start is pressed again) the internal watch time (which has been running) should be re-displayed and then continue as normal. Tower Prototyping Board This project requires more and different I/O than is present on the MCF52259 board (more than the 4 LED s, 2 push buttons, etc.). To provide the ability to prototype larger projects, we will utilize the Tower connectors. The elevators on the Tower (the sides of the tower where your board plugs into) take signals from your MCU and distribute them to other boards that plug into the tower. You will develop your code using specific pins defined later in the documentation, plug your individual microcontroller board into the development board, and test/debug your program. The stopwatch application requires 3 decimal-digit displays (tens, ones, and tenths of seconds). The prototyping board contains three 7-segment digit displays as shown in Figure 1. To save I/O pins, we will multiplex our data values to each display. We will use a separate 74LS273 8-bit register to control each 7-segment display. By using a separate I/O pin from the MCU to generate a clock strobe to each register we can multiplex these 8 data bit inputs to each register using just PORTTH[7:0]. Last Revised: 4/4/2012 1

74LS273_Tens A Q1 H Q8 ENB 74LS273_Ones A Q1 PORTTH[7:0] 8 H Q8 MCF52259 ENB PORTTG[0] PORTTG[1] PORTTG[2] 74LS273_Tenths A Q1 H Q8 ENB 7-Segment Digit GPIO Port(s) Ten Second Digit [7:0] Data in PORTTH then strobe PORTG[0] One Second Digit [7:0] Data in PORTTH then strobe PORTG[1] Tenth Second Digit [7:0] Data in PORTTH then strobe PORTG[2] Table 1 CLOCK strobe mappings a f g b dp g f e d c b a e c PORTTH 7 6 5 4 3 2 1 0 d dp Figure 1-7 Segment Display connections. Data in PORTTH is then transferred to separate 8-bit registers. The mapping of PORTTH bits to the 7-segments is shown above. 1=ON / 0=OFF. As an example: If we took the value 0x06, wrote it to PORTTH, then turned on PORTG[2], then turned off PORTG[2], the digit 1 would appear on the tenths digit. Note: You can also have the decimal point appear by setting the MSB of PORTTH. 2 Last Revised: 4/4/2012

Other I/O As input to your stopwatch you will use the two push-buttons on your microcontroller board (i.e. the same as those used in CF Lab 1). SW1 will serve as your start/stop button. When pressed it shall simply toggle the state unless in lap mode (more to come ). SW3 will serve as the lap/reset button. When the stopwatch is started/running, a press of SW3 will serve as the lap feature. Any subsequent press of either SW1 or SW3 will toggle the lap feature to return to running display of the current time. When the stopwatch is stopped, a press of SW3 will reset the time to 00.0. Suggested Approach It will likely be beneficial to keep a state or mode variable tracking what mode your stopwatch is in. Presses of the button will cause updates/transitions between modes and states as shown in Figure 2. What should be done in each state (whether the time should be incremented and what should be displayed should be fairly intuitive). You may also find it beneficial to keep an internal representation of the time (separate variables for each digit) and then only update the display I/O every tenth of a second (using some kind of timer interrupt). Stopped/Reset SW3 SW1 SW1 Lap SW3 Running / Started SW1 or SW3 Figure 2 - State Transition Diagram for the Stopwatch In terms of overall structure, there are many ways to organize your program. One suggested approach is to sit in a loop to poll the button inputs and update a state variable. Then inside your timer interrupt handler you can examine the state variable to determine if an update of the internal and/or displayed time is necessary. 4 Prelab You may re-use/modify code from the GPIO, timers, and any other training labs. You will want to download and review pertinent sections of the MCF52259 Reference Manual for specific I/O control register addresses and bit definitions. Last Revised: 4/4/2012 3

5 Procedure 1. Download the skeleton source code from Blackboard. 2. Complete the init_gpio() function provided to set up the appropriate output ports for the digit displays and sets their direction to output as well as the input ports for the pushbuttons (SW1 and SW3). 3. Use/alter code from your previous labs as a basis for completing the rest of the lab. You will need to integrate code from the timer lab to use PIT0 to generate an interrupt every 0.1s, code to poll the button inputs, and code for the main program that contains an infinite loop, simply responding to interrupts or I/O. 4. An array lut (look-up table) has been defined to translate a single decimal digit input to the necessary 7-segment on/off outputs. By accessing lut[0], the bit pattern for representing 0 on a 7-segment display will be returned. We have also defined symbolic names STOPPED, STARTED, LAP for you to use to track what state you are in. However, you are not required to use any of this. It is completely at your discretion in deciding what to use. 5. Your program should meet the following requirements: a. Initialize the count to 00:0 on startup. b. Correctly display all times on the 7-segment displays. c. Starting counting in tenths of seconds when SW1 is pressed and the timer is stopped. d. Stop counting in tenths of seconds when SW1 is pressed and the timer is started. e. Hold the displayed time while continuing internal time updates when SW3 is pressed and the timer is started. f. Update the display with the current internal time and continue counting when SW1 or SW3 is pressed and the display time is being held (i.e. LAP state). g. Reset the time to 00:0 when SW3 is pressed and the timer is stopped. 6. When you are satisfied with your code and it compiles, you may test it on one of the development boards we will provide in lab/class. However, without the development board you can still get an idea if the internal time is being kept correctly by setting a breakpoint in whatever handler updates the time and displays it. View the PORTTH and PORTTG register values via the debugger as well as your time variables/array. This is because the switches are on your individual board and thus all input stimulus can be exercised; just the output displays are missing. 7. Demonstrate your project to an instructor/ta and get their initials on your rubric. 4 Last Revised: 4/4/2012

8. Comment your code with enough information to convey your approach and intentions. Try to organize your code in a coherent fashion. 9. Submit your source file, via Blackboard (Assignments..Labs..Lab 4) attaching only the main.c file in the sources folder of your project. Make sure you click Submit on Blackboard and not just Save. Also, turn in a hardcopy of your main.c file to your TA. Last Revised: 4/4/2012 5

6 EE 357 Lab 4 Grading Rubric Name: Score: / 75 TA Initials: Req. / Guideline Req. 5a 1 Mult Score 4 (Excellent) 3 (Good) 2 (Poor) 1 (Deficient) (0) Failure Always Works Occasional Failure Does not work Req. 5b 2 Req. 5c 2 Req. 5d 2 Req. 5e 3 Req. 5f 3 Req. 5g 2 Req. 7 (demo) Req. 8 2 2 pts. Wellorganized and readable and wellcommented Wellorganized with acceptable formatting and comments Hard to read or poorly organized but commented well Hard to read or poorly organized and with poor commenting Extermely poor organization and formatting Hard Copy 5 pts. Late -10 per day TOTAL 6 Last Revised: 4/4/2012