1 ELE271 Mon. April 7, 2014 -Review LPM -Morse Code Lab -.ref and.def -Multiplication, shift.

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

Instruction Set Design
Chapter 8: Central Processing Unit
ECE 447 Fall 2009 Lecture 2: TI MSP430 Software Development C and MSP430 Assembly.
Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
Chung-Ta King National Tsing Hua University
Chung-Ta King National Tsing Hua University
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
A look at interrupts What are interrupts and why are they needed.
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
68HC11 Polling and Interrupts
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
1-1 Microprocessor Engineering Microprocessor Systems Microcontrollers Infineon 16-bit Processor Family  specifically 167CS microcontroller C Programming.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
EECE 344 – Microprocessors Quick Review. Information Representation Integer representation – whole numbers –Unsigned binary –2’s complement –Excess codes.
Chapter 7 Interupts DMA Channels Context Switching.
A look at interrupts What are interrupts and why are they needed.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Getting the O in I/O to work on a typical microcontroller Activating a FLASH memory “output line” Part 1 Main part of Laboratory 1 Also needed for “voice.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
The 8051 Microcontroller and Embedded Systems
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
LAB 7: WDT+ and Low-Power Optimization
V 0.91 Polled IO versus Interrupt Driven IO Polled Input/Output (IO) – processor continually checks IO device to see if it is ready for data transfer –Inefficient,
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
MICROPROCESSOR INPUT/OUTPUT
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Week 16.
Central Processing Unit. MAJOR COMPONENTS OF CPU.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
ELE22MIC Lecture 8 ASll Examples –16 Bit Counters –Buffalo Jump Table Interrupt processing (IRQ/RTI) Stack Frame & Base Pointer Wired OR.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
6-1 Infineon 167 Interrupts The C167CS provides 56 separate interrupt sources that may be assigned to 16 priority levels. The C167CS uses a vectored interrupt.
ECE 448 – FPGA and ASIC Design with VHDL Lecture 19 PicoBlaze Interrupt Interface & Assembly Code Development.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
ECE 447 Fall 2009 Lecture 4: TI MSP430 Architecture and Instruction Set.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
بسم الله الرحمن الرحيم MEMORY AND I/O.
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
One more PIC18F252 example and revision for exam B222L Branislav Vuksanovic, UoP, ECE.
Introduction Why low power?
Introduction Why low power?
Lecture 8: TI MSP430 Interrupts, ISRs
CS501 Advanced Computer Architecture
Microcontrollers & GPIO
CS4101 Introduction to Embedded Systems Lab 6: Low-Power Optimization
Microprocessor Systems Design I
Mon. Oct 2 Announcements Quiz Postponed to Wednesday – still only on 2.a + 2.b Video lecture for 2.a posted Lab 6 experiment extension You must come to.
Computer Architecture
The Central Processing Unit
Computer Organization & Assembly Language Chapter 3
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Subject Name: Microcontroller Subject Code: 10ES42
ECET 330 Innovative Education--snaptutorial.com
CENG2400 Revision Q1a A system has an ARM processor with a 32-bit General Purpose Input Output (GPIO) module. Two on/off switches are connected to bit-3.
Computer System Overview
Architectural Overview
“C” and Assembly Language- What are they good for?
ECE 3430 – Intro to Microcomputer Systems
Lecture 9: TI MSP430 Interrupts & Low Power Modes
Computer Architecture and Assembly Language
Chapter 6 Programming the basic computer
Chapter 13: I/O Systems.
Register sets The register section/array consists completely of circuitry used to temporarily store data or program codes until they are sent to the.
Presentation transcript:

1 ELE271 Mon. April 7, Review LPM -Morse Code Lab -.ref and.def -Multiplication, shift

Principles of Low-Power Apps Maximize the time in low-power modes. Sleep as long as possible and use interrupts to wakeup. Use the slowest clock while still meeting processing needs. Switch on peripherals only when needed (ie, switch off peripherals when not needed). Use low-power integrated computer peripherals. – Timers: Timer_A and Timer_B for PWM – A/D convertors, flash, LCD’s Use faster software algorithms / programming techniques – Calculated branches instead of flag polling. – Fast table look-ups instead of iterative calculations. – Use in-line code instead of frequent subroutine / function calls. – More single-cycle CPU register usage. 2 Low Power Modes

3 How are these concepts applied to microcontroller programming? The following techniques are applied to low power Design: -Use of Interrupts. -Controlling the clock. -Low Power design isn’t just for low power applications. -Low Power/Interrupt-driven design helps with modular design.

A method to reduce power consumption is to turn off some (or all) of the system clocks (and turning off the power to some circuits). A device is said to be sleeping when in low-power mode; waking refers to returning to active mode. MSP430 Clock Modes 4 Low Power Modes Average

Processor Clock Speeds Often, the most important factor for reducing power consumption is slowing the clock down. – Faster clock = Higher performance, more power required – Slower clock = Lower performance, less power required 5 Processor Clocks

6

7 MSP430 5xx Power Modes

8 ReservedV SCG1SCG0 OSC OFF CPU OFF GIENZC Active Mode LPM0 LPM3 LPM ~ 250 µA ~ 35 µA ~ 0.8 µA ~ 0.1 µA ; enable interrupts / enter low-power mode 0 bis.w #LPM0|GIE,SR ; LPM0 w/interrupts MSP430 Clock Settings (r2) Low Power Modes SMCLK and ACLK Active Sleep Modes Only ACLK Active No Clocks! Can be combined

9 Two problems with this: -What if you want to stay in active mode after ISR? -What if you want to keep ISR small (so you don’t turn off other interrupts)?

10 Review of stack interaction with interrupts.

11 PORT1_ISR bic.w #LPM4,0(SP) reti A mildly tricky line of assembly language is required to clear the bits set for the low power mode See Jimenez Ex. 7.4 How to come out of LPM in active mode.

12

13 Morse Code Lab -Interrupt-driven programming. -Multiple source files (.ref,.def directives) -Subroutines -Timers -Low Power Modes -Advanced data structures (pointers) -Exit an ISR in Active Mode (AM). This lab will illustrate the following concepts: Objective: to program the device using assembly code to toggle the LED to send a Morse Code message “SOS” each time S1 is pressed.

14 Assume one word. Assume only letters.

15 Morse code has a variable-length code for each character. ; letters--->A_ptr---->DOT,DASH,END ; A ; B_ptr---->DASH,DOT,DOT,DOT,END ; B,etc… Question: how to represent this in memory. Solution: use pointers or “relocatable expressions” in assembly:

16

17 Relocatable expressions

18 DOT.equ1 DASH.equ3 letters:.word A_ptr.word B_ptr,etc… A_ptr:.byte DOT,DASH,END ; A B_ptr:.byte DASH,DOT,DOT,DOT,END ; B, etc… A_ptr 0x5c000x5c10 01h 03h 00h 0x5c1303h 01h 00h dot dash end Morse Code Data Structure ; letters--->A_ptr---->DOT,DASH,END ; A ; B_ptr---->DASH,DOT,DOT,DOT,END ; B

19 Sleep; Get address of.cstring message. Get first character. While character != 0, do normalize ASCII to 41h (ie, so “A”=1) Get address of letters Get first code; code = dot or dash While code != 0, do Turn LED on Sleep(1|3) ; 1unit=dot,3 units=dash Turn LED off Sleep(1); 1 unit Get next code End While Sleep(3) Read next character. End while Morse Code Algorithm

while ( n > 0 ) { s1… } Loop: cmp #0,r6 dec r6 jzEnd s1… jmp Loop End: Usually a “while” statement implies a “cmp” RTN to Assembly: The While Statement Part 2 “while” loops cause jmp backwards Until condiion is met, then Jmp forward.

21 sleep If(pushbutton) do R4<-#message; get address of message R5<-(r4); get character pointed to by #message while (r5 != 0), do; keep getting another char unless zero r5<-r5-41h; normalize ASCII character to 40h (ie, A=0) r5<-r5*2; multiply by 2 for word boundary r7<-letters(r5); get first code for letter (dot or dash) while(r7 != 0), do; get next code unless end (0) beep(r7); beep amount of code (1 or 2) short_delay; short delay between beeps r5<-r5+1; increment address r7<-letters(r5); get next code endwhile r4<-r4+2; increment character address long_delay; long delay between characters Endwhile End if

22 Write an interrupt-driven program to toggle the LED based on the Morse Code. Learn how to use multiple source files with the.ref and.def directives. Learn how to use subroutines. Learn how use Timers. Learn how use Low Power Modes. Learn how use pointer data types. Learn how to come out of an ISR in active mode.