ECE 382 Lesson 14 Lesson Outline Polling Multiplexing Intro to Logic Analyzer Debouncing Software Delay Routines Admin Assignment 3b due BOC today Assignment.

Slides:



Advertisements
Similar presentations
Chapter 6 General Purpose Input/Output
Advertisements

Week10 Boolean Instructions on the Boolean Instructions  Boolean (or Bit) addressable capability is unique to the 8051  Enables efficient handling.
UBI >> Contents Chapter 7 Timers Laboratories MSP430 Teaching Materials Texas Instruments Incorporated University of Beira Interior (PT) Pedro Dinis Gaspar,
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
ECE 382 Lesson 6 Lesson Outline Example Assembly Code In class programming Debugging Assembly Code Lesson 6, 7, and 8 notes Admin CompEx1CompEx1  due.
Chung-Ta King National Tsing Hua University
1 Chapter 3 Jump, Loop, and Call Instructions. 2 Sections 3.1 Loop and Jump Instructions 3.2 Call Instructions 3.3 Time Delay Generation and Calculation.
Chung-Ta King National Tsing Hua University
University of Tehran 1 Microprocessor System Design Interrupt Omid Fatemi
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
Introduction of Holtek HT-46 series MCU
Debouncing Switches Mechanical switches are one of the most common interfaces to a uC. Switch inputs are asynchronous to the uC and are not electrically.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Embedded Systems UNIT 3. Pin Details of 8051 Pins 1-8: Port 1 Each of these pins can be configured as an input or an output. Pin 9: The positive voltage.
ECE 447 Fall 2009 Lecture 6: TI MSP430 IO Interfacing.
MSP Ultra-Low Power | High Integration | Easy-to-Use “How To” Series: Clock System.
Chung-Ta King National Tsing Hua University
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
Embedded Systems Design 1 Lecture Set 6 I/O Ports.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
Renesas Electronics Europe GmbH A © 2010 Renesas Electronics Corporation. All rights reserved. RL78 Clock Generator.
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
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.
CoE3DJ4 Digital Systems Design Chapter 4: Timer operation.
MICROPROCESSOR INPUT/OUTPUT
Lecture Set 9 MCS-51 Serial Port.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Ultra-low Power Motion Detection using the MSP430F2013.
Lecturers: Professor John Devlin Mr Robert Ross
CHAPTER HARDWARE CONNECTION. Pin Description 8051 family members ◦ e.g., 8751, 89C51, 89C52, DS89C4x0) ◦ Have 40 pins dedicated for various functions.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
TI MSP430 MICROCONTROLLERS BY ADITYA PATHAK. THE MSP FAMILY Ultra-low power; mixed signal processors Widely used in battery operated applications Uses.
Projects 8051.
ECE Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
The Intel 8086 Processor Josh Broome Dave Overstrom Jonathan Kagarise Christopher Lindsay.
ECE 447 Fall 2009 Lecture 4: TI MSP430 Architecture and Instruction Set.
Lecture 41 CSE 341 – Microprocessors Lecture 4 Md. Omar Faruqe UB 1228
Microprocessors A practical approach Lesson 2 Hardware description and Delays.
بسم الله الرحمن الرحيم MEMORY AND I/O.
Chapter Microcontroller
ECE 448 Lab 3 FPGA Design Flow Based on Xilinx ISE and ISim. Using Seven-Segment Displays, Buttons, and Switches.
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
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.
ADC 1 Analog to Digital Converter. ADC 2 ADC Features n General Features -Supports 8 or 10-bit resolution Modes, -Track period fully programmable up to.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Microprocessors A practical approach..
Seminar On 8085 microprocessor
Microcontrollers, Basics Tips and Tricks with PIC MCUs
ECE 382 Lesson 15 Lesson Outline S/W Delays Wrap up
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
ECE 382 Lesson 14 Lesson Outline Polling Multiplexing
Code review: GPIO, timer, and ISR
Chapter 6 General Purpose Input/Output
Lesson Outline Peripherals Memory-Mapped IO Ports GPIO Multiplexing
Lecture 6: TI MSP430 IO Interfacing
Programmable Interval Timer
Blinking an LED Using MSP430ware to Control GPIO
Interrupts, Tasks and Timers
8051 Single Board Computer (SBC) Version 1.0
AT91 Memory Interface This training module describes the External Bus Interface (EBI), which generatesthe signals that control the access to the external.
Lecture 9: TI MSP430 Interrupts & Low Power Modes
8051 Micro Controller.
Wireless Embedded Systems
CHAPTER HARDWARE CONNECTION.
Presentation transcript:

ECE 382 Lesson 14 Lesson Outline Polling Multiplexing Intro to Logic Analyzer Debouncing Software Delay Routines Admin Assignment 3b due BOC today Assignment 4 due BOC next class

Interfacing Peripherals to the MCU What is Polling? What are Interrupts? bic.b #BIT3, &P1DIR bis.b #BIT3, &P1REN bis.b #BIT3, &P1OUT poll_button: bit.b #BIT3, &P1IN jnz poll_button forever jmp forever

Homework Modify this program so the two LEDs always have the opposite value bis.b #BIT0|BIT6, &P1DIR ; output pin direction bic.b #BIT3, &P1DIR ; input pin direction bis.b #BIT3, &P1REN ; enable pin 3’s resistor bis.b #BIT3, &P1OUT ; make it a pull-up? (trick) check_btn: bit.b #BIT3, &P1IN jz set_lights bic.b #BIT0|BIT6, &P1OUT jmp check_btn set_lights: bis.b #BIT0|BIT6, &P1OUT jmp check_btn

Pitfall !!! Anything wrong with this? –mov.b #0xff, P1DIR What do these commands do? –mov.b #0b , &P1DIR –bis.b #0b , &P1OUT –mov.b #0xff, &P1OUT –mov.b &P1IN, r5

Multiplexing Only 20 Pins !!! But want access to many more signals –Therefore, each pin shares several signals  multiplexing Use PxSEL1 and PxSEL2 to select signal for each pin –The details are in the MSP430G2x53 2x13 Mixed Signal MCU Datasheet.MSP430G2x53 2x13 Mixed Signal MCU Datasheet

Pitfall !!! Let's say I wanted to make the UCA0SOMI function available on P1.1: –; 'from USCI' means this bit is set automatically by the USCI when enabled – bis.b #BIT1, P1SEL – bis.b #BIT1, P1SEL2

Logic Analyzer What is the difference between an O’Scope and a Logic Analyzer? Debouncing?

Logic Analyzer Debouncing: random bounces each time…

Is bouncing a problem? bis.b #BIT3, &P1OUT bis.b #BIT3, &P1REN bic.b #BIT3, &P1DIR clr r4 check_btn: bit.b #BIT3, &P1IN jz btn_pushed jmp check_btn btn_pushed: inc r4 wait: bit.b #BIT3, &P1IN jz wait inc r4 jmp check_btn

Debouncing Strategies How can we fix this?

Debouncing Strategies How can we fix this? –There is hardware debouncing –And there is software debouncing: Delay until bouncing has stopped –with a Software Delay Routine or –with a Hardware Counter Then resume What are some potential problems with this?

Debouncing Strategies How can we fix this? –There is hardware debouncing –And there is software debouncing: Delay until bouncing has stopped –with a Software Delay Routine or –with a Hardware Counter Then resume What are some potential problems with this? –You could delay for too short a period and still be impacted by bouncing. – You could delay for too long a period and miss good button pushes

Example Software Delay Routine How long is this software delay? call #software_delay software_delay: push r5 mov.w #0xaaaa, r5 delay: dec r5 jnz delay pop r5 ret MSP430 Family Users Guide, p 60 for cycles per instruction

Example Software Delay Routine How long is this software delay? call #software_delay ; 5 cycles software_delay: push r5 ; 3 cycles mov.w #0xaaaa, r5 ; 2 cycles delay: dec r5 ; 2 cycles ; no 1 cycle !!! jnz delay ; 2 cycles pop r5 ; 2 cycles ret ; 2 cycles ; no 3 cycles !!! (0xaaaa * (1 + 2)) = total clock cycles Only variable is r5… if I change r5 by “one”, how many cycles is this? (ie., precision of delay?) So, How long in time is this?

MSP430’s Digitally Controlled Oscillator MSP430’s Clock = Digitally Controlled Oscillator (DCO) –Advantage: It is tunable. Can run at many different frequencies –Disadvantage: It is an RC oscillator, so can be inaccurate –Default: 1 MHz, with significant variance (0.8MHz - 1.5MHz) –Fix: At the factory, each chip is calibrating with a more accurate quartz crystal resonator. TI stores the proper calibrated values for DCOCTL and BCSCTL1 for 1MHz, 8MHz, 12MHz, and 16MHz in protected memory. We can measure clock speed (SMCLK) on P1.4

SMCLK bis.b #BIT4, &P1DIR bis.b #BIT4, &P1SEL forever jmp forever If Clock period is 912ns, how long is clock cycles?

Measure Software Delay Routine bis.b #BIT0, &P1DIR here: bic.b #BIT0, &P1OUT call #software_delay bis.b #BIT0, &P1OUT call #software_delay jmp here software_delay: push r5 mov.w #0xaaaa, r5 delay: dec r5 jnz delay pop r5 ret

Measure SW delay routine bis.b #BIT4, &P1DIR bis.b #BIT4, &P1SEL forever jmp forever If Clock period is 912ns, how long is clock cycles?

Debounced code with SW delay bis.b #BIT3, &P1OUT bis.b #BIT3, &P1REN bic.b #BIT3, &P1DIR check_btn: bit.b #BIT3, &P1IN jnz check_btn call #software_delay jmp btn_pushed btn_pushed: bit.b #BIT3, &P1IN jz btn_pushed call #software_delay jmp check_btn software_delay: push r5 mov.w #0xaaaa, r5 delay: dec r5 jnz delay pop r5 ret