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

Similar documents
Lab 4 Interrupts ReadMeFirst

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

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

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

063[[[0LFURFRQWUROOHUV /RZ3RZHU0RGHV &3($GYDQFHG0LFURFRPSXWHU7HFKQLTXHV 'U(PLO-RYDQRY /RZ3RZHU. Power: A First-Class Architectural Design Constraint

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

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

MSP430xxxx Microcontrollers Low Power Modes

MSP430. More on MSP430

University of Texas at El Paso Electrical and Computer Engineering Department

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

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

6. General purpose Input/Output

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

Lecture 5: MSP430 Interrupt

Micro computer Organization


Timer Module Timer A. ReadMeFirst

Block diagram of processor (Harvard)

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

Lecture-55 System Interface:

Microcomputer Architecture and Programming

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)

2006 Mixed Signal Products SLAU049F

Topics. Interfacing chips

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

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

EECE 340 Introduction to Microprocessors w/lab Section A. Term Project Parking Visitor Counter

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

These three counters can be programmed for either binary or BCD count.

Chapter 1: Basics of Microprocessor [08 M]

What is an Interrupt?

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

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

Lab 9: On-Board Time Generation and Interrupts

CPE/EE 421 Microcomputers

Introduction to Embedded Systems

Question Bank Microprocessor and Microcontroller

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

5xx Active & Low Power Mode Operation

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

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

AGH University of Science and Technology Cracow Department of Electronics

Registers Format. 4.1 I/O Port Address

Today's plan: Announcements General Strategy Microcontroller programming concepts/last bits of assembly Activity 2

Unit B - Rotary Encoders B.1

Hacettepe University

SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET

Chapter 1 MSP430 Microcontroller Family

Interrupts, Low Power Modes

Lecture test next week

Network Embedded Systems Sensor Networks Fall Hardware. Marcus Chang,

Designing for Ultra-Low Power with MSP430

AGH University of Science and Technology Cracow Department of Electronics

Wireless Sensor Networks (WSN)

8051 Microcontroller

Chapter 7 Central Processor Unit (S08CPUV2)

MICROPROCESSOR AND MICROCONTROLLER BASED SYSTEMS

Timers and Counters. LISHA/UFSC Prof. Dr. Antônio Augusto Fröhlich Fauze Valério Polpeta Lucas Francisco Wanner.

Copyright 2009 Texas Instruments All Rights Reserved

Microcontroller & Interfacing

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

1. Internal Architecture of 8085 Microprocessor

8086 INTERNAL ARCHITECTURE

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

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

Basics of Microprocessor

Programming With the MSP430AFE2xx Family and the MSP430i20xx Family

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Hacettepe University

Unit wise Question Bank UNIT-II

Microprocessors/Microcontrollers

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

8254 is a programmable interval timer. Which is widely used in clock driven digital circuits. with out timer there will not be proper synchronization

8051 Microcontroller Interrupts

Microprocessors & Interfacing

2006 Mixed Signal Products SLAU049F

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

embos Real Time Operating System CPU & Compiler specifics for Texas Instruments MSP430 CPUs and Rowley compiler for MSP430 Document Rev.

IAR PowerPac RTOS for Texas Instruments MSP430 Microcontroller Family

Introduction to Microcontrollers

8085 Microprocessor Architecture and Memory Interfacing. Microprocessor and Microcontroller Interfacing

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

INTRODUCTION OF MICROPROCESSOR& INTERFACING DEVICES Introduction to Microprocessor Evolutions of Microprocessor

Control Unit: The control unit provides the necessary timing and control Microprocessor resembles a CPU exactly.

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

Laboratory Exercise 4


School of Computer Science Faculty of Engineering and Computer Science Student ID Number. Lab Cover Page. Lab Date and Time:

WT6510. USB Keyboard Controller (Mask ROM Type)

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Machine Cycle- 1: OFMC: Status signals IO/M=0, S 1 =1, S 0 =1

DEPARTMENT OF ECE QUESTION BANK SUBJECT: MICROPROCESSOR AND MICROCONTROLLER UNIT-1 PART-A (2 MARKS)

8051 Overview and Instruction Set

Laboratory: Introduction to Mechatronics

INTERFACING INTERFACING. Richa Upadhyay Prabhu. NMIMS s MPSTME February 25, 2016

Hello, and welcome to this presentation of the STM32 Real- Time Clock. It covers the main features of this peripheral, which is used to provide a

Microcontrollers and Interfacing week 8 exercises

Laboratory 10. Programming a PIC Microcontroller - Part II

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

Transcription:

University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 03 Low Power Mode and Port Interrupts Goals: Bonus: Pre Lab Questions: Learn how to operate in LPM (Low Power Mode). Learn how to implement Port Interrupts in your designs. Create an 8-bit BCD (Binary Coded Decimal) Counter. The counter should have three functions implemented with three buttons: increment, decrement and reset to zero. Current value of counter should be outputted to an SSD (Seven Segment Display); 8 LEDs may be used instead -10. Counter should count from 0 99. Design must be LPM and Interrupt Driven. Write your Binary to Decimal encoding algorithm/subroutine in10 lines of code or less. +10 Write your own BCD to SSD subroutine to output the current value to the SSD (do not use an external BCD decoder chip). +20 Of the 5 LPM modes, which Low Power Mode did you choose to use? Did it matter; why or why not? Which port did you use for your inputs; outputs? Did you use an infinite loop; why or why not?

Lab Guide Today s engineering designs are moving towards energy efficient designs. This means we must learn to develop systems that are low power and interrupt driven. Read below to find out more. Low Power Mode LPM allows us to operate at a much lower than our already minuscule current consumption rate. See the graph below taken from Section 2.3 Operating Modes from the MSP430x2xx Family User's Guide (Rev. I): In LPM, various crystals, clocks and the CPU are disabled. You must take care that the peripheral you are relying on is not dependent on any of these timing sources.

Below is a table summarizing the different Low Power Modes: MODE MACROS CONTROL BITS CPU & CLOCK STATUS Function Bit SCG1 SCG0 OSCOFF CPUOFF Active -- -- 0 0 0 0 CPU is active, all enabled clocks are active. LPM0 LPM0 LPM0_bits CPU, MCLK are disabled, SMCLK, ACLK are 0 0 0 1 active. LPM1 LPM1_bits CPU, MCLK are disabled. DCO and DC LPM1 0 1 0 1 generator are disabled if the DCO is not used for SMCLK. ACLK is active. LPM2 LPM2 LPM2_bits CPU, MCLK, SMCLK, DCO are disabled. DC 1 0 0 1 generator remains enabled. ACLK is active. LMP3 LPM3 LPM3_bits CPU, MCLK, SMCLK, DCO are disabled. DC 1 1 0 1 generator disabled. ACLK is active. LPM4 LPM4 LPM4_bits 1 1 1 1 CPU and all clocks disabled. Table 1 - Low Power Mode Details Note: Obviously, we cannot use a timer interrupt to wake from a LPM in which we have a clock disabled as that will make the associated timer interrupt inactive. Port Interrupts Just like with the previous Port Registers we learned about, Port Interrupt Registers are 8-bit and work the same way as far as bits corresponding to certain pins. Below is a description of each: PxIE - Interrupt Enable; 0 Disable; 1 Enable PxIES - Interrupt Edge Select; 0 Rising Edge; 1 Falling Edge PxIFG - Interrupt Flag; 0 Cleared; 1 Set Ports 1 and 2 are never disabled when entering a LPM. If you want to save even more power, you must set all output pins to inputs and ground them with the internal resistor (Pulldown Configuration). This means that we will (almost) always be able to use a Port Interrupt to wake from LPM. For more information on Low Power Mode and Port Interrupts, see the Interrupts Guide.

8-bit BCD (Binary Coded Decimal) Counter In this lab, we will be designing an 8-bit BCD (Binary Coded Decimal) Counter. Simply put, every nibble in binary represents a power of tens place in decimal. See the table below for a better understanding: Decimal Number MSN (Tens) LSN (Ones) 0 0000 0000 1 0000 0001 2 0000 0010 98 1001 1000 99 1001 1001 For example, if we wanted to encode the decimal number 47, we would use 01000111. Notes: It is possible to enter LPM during an ISR (Interrupt Service Routine). However, you must remember reset the GIE bit in the SR. The easiest way to do this is to re-enable general interrupts right before entering LPM. See the Interrupts Guide for more details. You may enter a different LPM or return to Active Mode after an Interrupt. Ports do not rely on any timing source. LPM allows us to neglect using an infinite while loop in our main program. Other than code to setup the necessary registers and enter LPM, there should be no other code in the main program. If your micro is currently in LPM, you will not be able to see where in code you are until an interrupt is triggered.

Lab Hints Because we are using a LPM and Interrupt Driven design, we will not be needing an infinite while loop. Normally we would use an empty infinite while loop as such: while(1){}; Instead, we will setup our Port Registers (I/O and Interrupt) and then immediately enter LPM. We will wake the micro with a Port Interrupt, manipulate the BCD Counter value and re-enter LPM. See the flowchart below for help: INITIAL SETUP (WDT, Ports, Interrupts) PORT 1 ISR Enter LPM Button 0 Pushed? Yes Increment Counter Value Jump to PORT 1 ISR No Button 1 Pushed? Yes Decrement Counter Value Convert Counter Value from Binary/Decimal to BCD Output to SSD or 8 LEDs No Button 2 Pushed? Yes Reset Counter Value to Zero No Remember to use a Global Variable to hold the binary/decimal counter value.

Post Lab Lab Notebook Questions: Explain why it is preferable to use interrupts instead of polling. Is polling completely avoidable? Are infinite loops in the main program completely avoidable? What happens when you go into a LPM; what happens when you return?

Frequently Asked Questions Do all pins go to the same ISR? Yes. Both Ports 1 and 2 have their respective ISRs and each of their pins source (trigger) these ISRs. So then how can I know what pin sourced the ISR? If you have multiple possible sources for the ISR, you must read the PxIFG register to see what bit is set; the set bit will tell you which pin sourced the ISR. How do I connect my switch!? Checkout the diagram below if you are having trouble connecting your switch: