Reading: Davies , 8.3-4, , MSP430x55xx User's Guide Ch. 5,17

Similar documents
Reading: Davies , 8.3-4, , MSP430x55xx User's Guide Ch. 5,17, MSP430F5529 Launchpad User's Guide

ECE PRACTICE EXAM #2 Clocks, Timers, and Digital I/O

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #11: More Clocks and Timers

ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class)

ECE2049: Embedded Systems in Engineering Design Lab Exercise #3 C Term Making a Time and Temperature Display

Timer Module Timer A. ReadMeFirst

ECE2049: Embedded Computing in Engineering Design A Term Fall 2017 Lecture #16: Interrupts and Event Driven Code

CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B

Timers and Clocks CS4101 嵌入式系統概論. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan

ECE2049 HW #1-- C programming and Binary Number Representations (DUE 1/19/2018 At the BEGINNING of class)

ECE2049 HW #1-- C programming and Binary Number Representations (DUE Friday 8/31/2018 At the BEGINNING of class)

Copyright 2015 by Stephen A. Zajac & Gregory M. Wierzba. All rights reserved..spring 2015.

ECE2049: Embedded Computing in Engineering Design C Term Spring 2019 Lecture #22: MSP430F5529 Operating Mode & the WDT

5xx Active & Low Power Mode Operation

ECE2049 HW #1-- C programming and Binary Number Representations (DUE 9/1/2017 At the BEGINNING of class)

Lab 1: I/O, timers, interrupts on the ez430-rf2500

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

Lab 4 Interrupts ReadMeFirst

CPE 323: MSP430 Timers

Hacettepe University

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #7: More Digital IO

Moses Jones Application Note ECE 480 Design Team 7 Programming Altimeters. Using MSP 430 Launch Pad 11/8/2013

Lab 4: Interrupt. CS4101 Introduction to Embedded Systems. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan

2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website:

ECE2049: Embedded Computing in Engineering Design A Term Fall Lecture #8: Making it work: LEDs, Buttons & Keypad

Hacettepe University

ECE2049 Homework #4 Analog-to-Digital Conversion and the ADC12 (Due Thursday 2/15/2018 to box outside AK-011 by 9 am)

ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #20: Using SPI The DAC

CPE 325: Embedded Systems Laboratory Laboratory #11 Tutorial Analog-to-Digital Converter and Digital-to-Analog Converter

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website:

The 16-bit timer/counter register, TAR, increments or decrements (depending on mode of operation) with each rising edge of the clock signal.

ECE2049 Embedded Computing in Engineering Design. Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

ECE2049-E18 Lecture 6 Notes 1. ECE2049: Embedded Computing in Engineering Design E Term Lecture #6: Exam Review

ECE2049 E17 Lecture 4 MSP430 Architecture & Intro to Digital I/O

Texas Instruments Mixed Signal Processor Tutorial Abstract

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #3: Of Integers and Endians (pt. 2)

ECE2049: Embedded Computing in Engineering Design A Term Fall Lecture #9: Exam Review w/ Solutions

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -2 1 UNIT 2

What is an Interrupt?

MSP430. More on MSP430

CPE/EE 421 Microcomputers

Team 3. By: Miriel Garcia. Microcontrollers/ TI MSP430F5438A. ECE 480 senior Design. Application Note 4/3/15

// Conditions for 9600/4=2400 Baud SW UART, SMCLK = 1MHz #define Bitime_5 0x05*4 // ~ 0.5 bit length + small adjustment #define Bitime 13*4//0x0D

15.1 Timer_A Introduction

Welcome to Lab! You do not need to keep the same partner from last lab. We will come around checking your prelabs after we introduce the lab

IAR PowerPac RTOS for Texas Instruments MSP430 Microcontroller Family

Time. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 37

2. (2 pts) If an external clock is used, which pin of the 8051 should it be connected to?

Finally, a receipt is printed on the screen and, after a pause, the process repeats for the next customer.

Interrupts CS4101 嵌入式系統概論. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan

ECE2049-E17 Lecture 6 1. ECE2049: Embedded Computing in Engineering Design E Term Lecture #6: Exam Review

Embedded Systems. 3. Hardware Software Interface. Lothar Thiele. Computer Engineering and Networks Laboratory

Alex Milenkovich 1. CPE/EE 421 Microcomputers. Course Administration. Review: Outline. Getting Started with EasyWeb2. Review: MSP bit RISC

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

MSP430 Interrupts. Change value of internal variable (count) Read a data value (sensor, receive) Write a data value (actuator, send)

Network Embedded Systems Sensor Networks Fall Hardware. Marcus Chang,

ECE2049: Embedded Computing in Engineering Design C Term Spring 2018

Embedded Technosolutions

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II

CPE/EE 421 Microcomputers

18-642: Time and Date

University of Florida EEL 4744 Spring 2014 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering 1 April Apr-14 9:03 AM

Getting Started with the Texas Instruments ez430

CPE 323 Introduction to Embedded Computer Systems: MSP430 System Architecture An Overview

MSP430F20xx Device Erratasheet

CS16 Midterm Exam 2 E02, 10W, Phill Conrad, UC Santa Barbara Tuesday, 03/02/2010

Magic 8 Ball. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

MSP430 Teaching Materials

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag

ECE 476 LABORATORY 3 SECURITY SYSTEM WEDNESDAY, MARCH 7, 2007

Application Report. 1 Hardware Description. John Fahrenbruch... MSP430 Applications


Fall. Accelerometer RGB LED control Vishal Shah Rebel Sequeira Pratiksha Patil Pranali Dhuru Chris Blackden. George Mason University

ECE251: Thursday November 8

CPE 323 Introduction to Embedded Computer Systems: ADC12 and DAC12. Instructor: Dr Aleksandar Milenkovic Lecture Notes

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

Alex Milenkovich 1. CPE/EE 421 Microcomputers: The MSP430 Introduction. Outline

CPE/EE 323 Introduction to Embedded Computer Systems Homework V

Hands-On: Implementing an RF link with MSP430 and CC1100

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

May the Schwartz be with you!

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE

Artisan Technology Group is your source for quality new and certified-used/pre-owned equipment

CS1 Lecture 3 Jan. 18, 2019

ECE2049: Homework 1. Consider the following code to compute the average of your exam grades: #define NUM_EXAMS (3)

8051 Peripherals. On-Chip Memory Timers Serial Port Interrupts. Computer Engineering Timers

Towards Hard Real-time Performance in a Highly Asynchronous Multitasking MSP430 Application Andrew E. Kalman, Ph.D.

Timer 32. Last updated 8/7/18

bc620at Developer s Kit User s Guide November, 1998

Interrupts and Timers

Lecture 5: MSP430 Interrupt

ECE Homework #10

***PRACTICE EXAM 02 for*** CS16 Midterm Exam 2 E02, 09F, Phill Conrad, UC Santa Barbara Actual exam scheduled for: 11/18/2009

Using programmed I/O on the M16C; and Writing an Interrupt Service Routine (ISR)

MATH 099 HOMEWORK TWO

University of Florida EEL 3744 Spring 2018 Dr. Eric M. Schwartz. Good luck!

Lab 1 Implementing a Simon Says Game

Transcription:

ECE2049 Homework #3 Clocks & Timers (Due Tuesday 9/19/17 At the BEGINNING of class) Your homework should be neat and professional looking. You will loose points if your HW is not properly submitted (by properly I mean stapled with a cover sheet including your ECE box number). Any code should be typed! Reading: Davies 2.6. 5.8, 8.3-4, 8.9-10, MSP430x55xx User's Guide Ch. 5,17 Problem 1 (20 pts) a) Check the MSP430F559 Launchpad Schematic. What are the exact frequencies of the crystals XT1 and XT2 on our lab board? b) To what frequencies are ACLK, MCLK and SMCLK set by default by Code Composer Studio? What are the range of possible clock frequencies for MCLK and SMCK? What is each clock (ACLK, MCLK and SMCLK) primarily used for? c) The following line is executed at the beginning of configdisplay() during system initialization by our demo project code. We are working with the clock system not digital IO. Why is it necessary? What does it do? Why do you think none of the buttons, or LEDs or the keypad, or scroll wheel, etc., use any port 5 pins? P5SEL = (BIT5 BIT4 BIT3 BIT2); d) Below are the values of the Unified Clock System registers for two different MSP430 applications. Use the MSP430x55xx User's Guide Chapter 5 and class notes to decode the bit fields for each register. What are the resulting values of ACLK, MCLK, and SMCLK in each case. (Hint: see Users Guide page 164 for f DCOCLK equations) UCSCTL0 = 0x12A8 UCSCTL1 = 0x0040 UCSCTL2 = 0x1004 UCSCTL3 = 0x0050 UCSCTL4 = 0x0044 UCSCTL5 = 0x0010 UCSCTL6 = 0xC0CC UCSCTL7 = 0x0403 UCSCTL8 = 0x0707 e) Write a C function (see prototype below) that expressly turns on both XT1 and XT2 (see UCSCTL6) and sets the frequency of MCLK and SMCLK either 1.8 MHz or 18MHz (or as close as you can get) depending on the value of the input argument. Explain whether you used XT1 or XT2 as source for DCO REFCLK for each frequency and why. Assume all other clock settings are to be left in their default state. You may still assume that P5.5-2 are set as shown in (c) at the top of configdisplay() and that they do not have to be configured by your function. Your code must be typed to be graded. void clks_1x_10x(unsigned char speed_option);

Problem 2 Time standards are very important to the scientific, engineering and computing communities. However, precisely keeping track of time all over the world is a deceptively tricky business. Watch this video and do a bit of Googling and tell me the following. (30 pts) a) What is Coordinated Universal Time (UTC)? What is the time zone for Colombo, Sri Lanka in terms of UTC, (e.g. Minsk, Belarus is UTC + 2:00)? In the scientific community, times are often written something like 19:00Z, read as 19 hundred Zulu. What is Zulu time? In computing, UTC based time scales usually store the current time as the number of seconds that have elapsed since the beginning of some epoch. Usually the number of elapsed seconds are stored in a 32-bit unsigned integer. b) What is the start date of the Network Time Protocol (NTP) epoch? If 0 seconds corresponds to midnight (i.e. 00:00:00) on the first day of the NPT epoch, how many full years plus days, hours, minutes and seconds can be stored in a 32-bit unsigned integer? In many systems it is more practical to just consider the seconds in the current year. The time format is modified such that a count of 0 seconds corresponds to midnight January 1 of the current year with a second variable holding the year. c) If a UTC-style clock counting whole seconds was initialized to 0 at midnight 1 Jan 2017 currently has a count of 19,400,000 seconds what day (i.e. date) and time is it? Like April 3, 8:43:02 am. Hint: Remember that days are counted from 1. d) An autonomous data logger device is to be placed on the ocean floor for 6 months during which it will automatically take various oceanographic measurements. It must be able to measure the time elapsed since deployment to within 5 millisecond throughout its operational life. The engineers have designed the device to record for a maximum of 200 days in case there were to be a delay in device retrieval. Can the engineers use a 32-bit unsigned integer to store time to within 5 ms inside this data recorder? Or, must they use a 64-bit variable? Explain your answer. e) How would you configure TimerA2 to implement a clock with 5 ms resolution assuming SMCLK has already been configured to equal 4 MHz? Write a C code segment (including the TimerA2 setup and TimerA2 ISR) implementing a clock that saves its time (count) to a variable of the appropriate size (as determined in part d). You do not have to configure the UCS registers to set the value of SMCLK. Your timer should generate interrupts only once per millisecond. Do you need leap counting? Explain. f) Create a C function that converts the timer count from parts d & e to recorder mission day, hours, minutes and sec.sss. The count of days should starts at 1 not 0 (e.g. Mission Day 1 00:00:00.000 is midnight on the first deployed day). Your code must be typed to be graded. You do not have to convert your results to ascii for display.

Problem 3 For a certain application TimerA2 has been configured as shown below. a) What is the exact time between interrupts. Assume that ACLK, SMCLK and MCLK are running at their default settings. (20 pts) void runtimera2(void) { TA2CTL = TASSEL_2 MC_1 ID_3; TA2CCR0 = 1310; TA2CCTL0 = CCIE; // enable Timer A2 interrupt } b) If the system clock and TimerA2 settings from part (a) are used implement a timing system, how long until the time displayed by that system is off by 0.005 seconds? By 0.01 seconds? Will the system be fast or slow? How do you know? c) Write the interrupt service routine for TimerA2 for this application. Include a single level of leap counting to keep the display accurate for longer. How long until you leap counting system is off my 0.005 sec. Your code must be typed to be graded. d) Assume the MSP430 clocks have been configured to the following frequencies. ACLK = 32,768 Hz MCLK = 2.0 MHz SMCLK = XT2 = 4.0 MHz What is the smallest time interval you could theoretically measure using TimerA2 assuming these settings for MCLK, SMCLK and ACLK? Could your MSP430 system actually function with the Timer set to that interval? Explain why or why not.

Problem 4 A new style of automated gas pump (controlled by an MSP430F5529) dispenses product a constant, fixed rate of 0.15 gallons per second. The pump needs to be able to calculate the total cost of the product dispensed to at least 1/10 th cent = 0.001 dollars. Right now the pump is design to work for gasoline products could be priced up to $9.00 per gallon. (30 pts) a. The MSP430 will use Timer A2 to measure how long the pump is depressed (i.e. how long product is being delivered). What timer interval should Timer A2 be set to in order to able to measure total cost to 0.1 cents accuracy for a products costing up to $9.00? Which requires finer time resolution to meet the 0.1 cent spec, a higher priced product or a lower priced one? b. Assume that SMCLK has already been configured to equal XT2. Write a function in C to setup TimerA2 using SMCLK divided by 2 as its clock to measure the interval you determined in part (a). Also show your interrupt service routine. c. Assume a user fills up with 12.3 gallons of gas and gas currently cost $6.76 per gallon (OK, assume we're in Europe some place). How long will the fill-up take. What is the accuracy of you pump in cents for gas at this price. Remember, the pump always dispenses at 0.15 gal/sec. d. Now assume that the XT2 crystal used with your MSP430F5529 is on the low end of its tolerance and actually oscillates at 4,000,025 Hz (i.e. it is 0.000625% off.) What would the error associated with your timer at the end of the 11.4 gallon fill up be given that you designed your timer assuming XT2CLK = 4.0 MHz exactly. Will your actual time count be fast of slow? By how much will you have overcharged or under charged for the gas? Explain.

ECE2049 Homework #3 Submitted by: ECE Box #: Date: Question Grade 1-20 2-30 3-20 4-30 Total (100):