Lesson Outline Peripherals Memory-Mapped IO Ports GPIO Multiplexing

Slides:



Advertisements
Similar presentations
Chapter 6 General Purpose Input/Output
Advertisements

1 ECE 372 – Microcontroller Design Parallel IO Ports - Outputs Parallel IO Ports E.g. Port T, Port AD Used to interface with many devices Switches LEDs.
ECE 382 Lesson 14 Lesson Outline Polling Multiplexing Intro to Logic Analyzer Debouncing Software Delay Routines Admin Assignment 3b due BOC today Assignment.
Chung-Ta King National Tsing Hua University
1. 2 FRC 2010 Driver Station Doug Norman & Stephanie Brierty National Instruments January 8, 2010 Thanks to Joe Ross – Team 330.
Introduction of Holtek HT-46 series MCU
HT46 A/D Type MCU Series Data Memory (Byte) Program Memory HT46R22 (OTP) HT46C22 (Mask) 2Kx Kx16 4Kx HT46R23 (OTP) HT46C23 (Mask) HT46R24.
1 ECE 263 Embedded System Design Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System.
ECE Lecture 1 1 L15 – Digital I/O Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
Chapter 6 – MSP430 Micro-Architecture. BYU CS/ECEn 124Chapter 6 - MSP430 Micro-Architecture2 Concepts to Learn… Computer Architecture MSP430 Micro-Architecture.
Chapter 6 – MSP430 Micro-Architecture
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
Microprocessor Block Diagram
Arduino Josh Villbrandt February 4, Digital Circuits Analog versus digital – What’s the difference? – How to represent an analog signal in a computer?
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 ARM University Program Copyright © ARM Ltd 2013 General Purpose I/O.
1 ARM University Program Copyright © ARM Ltd 2013 General Purpose I/O.
Lecture 11: TI MSP430 Timers Compare Modes
ECS642U Embedded Systems Digital I/O William Marsh.
1 LHO 13 The 8051CF020 and the University Daughter Card.
Lecturers: Professor John Devlin Mr Robert Ross
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
AVR Programming: Digital I/O September 10, What is Digital I/O? Digital – A 1 or 0 Input – Data (a voltage) that the microcontroller is reading.
IO Subsystem IV Ports and peripherals. IO Subsystem (1) All devices connected to the system buses, other than memory and CPU – Input and output ports.
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
Microcontroller Intel 8051 [I/O Ports]. Pin out of the 8051 –40 pin package –32 pins are used for the 4 ports. –V CC / V SS –ALE Address Latch Enable.
ECE Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
1-3 GPIO_Output(LuminaryLibrary) 1.Alter the output current to 4mA 2.Let LED0 turn on but LED 1 turn off. Modify your program in E:\yourname\arm.
EE365 - Microprocessors period 26 10/23/00 D. R. Schertz # Parallel Ports.
I/O Interface. INTRO TO I/O INTERFACE I/O instructions (IN, INS, OUT, and OUTS) are explained. Also isolated (direct or I/O mapped I/O) and memory-mapped.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an introduction to the peripheral functions.
Components of a typical full-featured microcontroller.
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.
Chapter 2 MSP432 ARM I/O Programming 1. Chapter Review Section 2.1: MSP432 Microcontroller and LaunchPad Section 2.2: GPIO (General Purpose I/O) Programming.
ECE 382 Lesson 32 Lesson Outline Lab 6 Introduction Pulse Width Modulation Capture / Compare Example Lab 6 Tips Admin Lab#6 “prelab” due BOC lesson 33.
Case Study #1 Microcontroller System. What is a microcontroller? A microcontroller can be considered a self-contained system with a processor, memory.
Application Case Study Christmas Lights Controller
Why are Timer Functions Important?
ECE 3430 – Intro to Microcomputer Systems
CS4101 嵌入式系統概論 General Purpose IO
ECE 382 Lesson 22 Readings Lesson Outline Writing Clean Code
ECE 382 Lesson 15 Lesson Outline S/W Delays Wrap up
80C51 Block Diagram ECE Overview.
Microcontrollers, Basics Fundamentals of Designing with Microcontrollers 16 January 2012 Jonathan A. Titus.
ECE 382 Lesson 14 Lesson Outline Polling Multiplexing
Lesson Outline Interrupts Admin Assignment #9 due next lesson
Code review: GPIO, timer, and ISR
Microcontrollers & GPIO
ECE 3430 – Intro to Microcomputer Systems
Chapter 6 General Purpose Input/Output
CS4101 Introduction to Embedded Systems Lab 1: General Purpose IO
Refer to Chapter 10 in the reference book
General Purpose I/O.
CS4101 嵌入式系統概論 General Purpose IO
Blinking an LED Using MSP430ware to Control GPIO
The Arduino Microcontroller: Atmel AVR Atmega 328
EET 2261 Unit 11 Controlling LCD and Keypad
Subject Name: Microcontroller Subject Code: 10ES42
Introduction to Microprocessors and Microcontrollers
Interfacing Memory Interfacing.
University of Illinois, at Urbana-Champaign
EET 2261 Unit 11 Controlling LCD and Keypad
Journey: Introduction to Embedded Systems
Microcontroller Labs Lab 1 – The LED Test Mode Dr. Gregg Chapman
CS4101 Introduction to Embedded Systems Lab 2: Basic IO and Timer
ADSP 21065L.
I/O Experiments Assignment 1.
A modular robot for use in the RoboSumo lab
Presentation transcript:

Lesson Outline Peripherals Memory-Mapped IO Ports GPIO Multiplexing ECE 382 Lesson 13 Lesson Outline Peripherals Memory-Mapped IO Ports GPIO Multiplexing

Peripherals What are Peripherals? MSP430G2xx Peripherals? MSP430 wikipedia: Watchdog Timer Universal Serial Communication Interface (USCI) Implements SPI and I2C protocols We'll use SPI to interface with the LCD in your black box Pulse Width Modulation (PWM) We'll use this later to drive the robot Temperature Sensor Multipliers Capacitive Touch I/O For working with touch screens, etc

Ports What are Ports? Examples? Your LaunchPad Board has… Port 1, Pin 0 to Pin 7 Port 2, Pin 0 to Pin 5 (where are pin 6 and 7?)

68HC12

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.

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

How do we talk to Ports? Do I/O? Two classic methods Memory-Mapped I/O (Motorola) Port-Mapped I/O [or Isolated IO] (Intel) Memory-Mapped I/O I/O and memory SHARE the same address space Advantage Fewer instructions Can use all addressing modes Disadvantage Lose memory to IO Programmer mistakes How to use mov.b #0x55, &P1OUT mov.b #0x55, &0x0021 User’s Guide p 333, Table 8-2 (BB pp 41) Watchdog Timer, page 341 (BB pp 42)

How do we talk to Ports? Do I/O? Port-Mapped I/O (Intel) I/O and memory have their own separate address space Advantage Don't lose memory for IO. Protects coder from mistakes. Disadvantage Need More Instructions (like In/Out) More restrictive addressing modes Works only with limited registers How to use Out #0x55, &PORT1

General Purpose Input Output (GPIO) The registers used to configure GPIO are PxDIR, PxREN, PxOUT, and PxIN PxDIR configures which pins are input and which pins are output 1 corresponds to output, 0 to input PxREN controls pull up / pull down resistors to avoid floating inputs. Writing to PxOUT controls the output of each pin PxIN allows you to read the values on these pins Let's write a program that controls the onboard LEDs with the onboard push button bis.b #BIT0|BIT6, &P1DIR bic.b #BIT3, &P1DIR check_btn: bit.b #BIT3, &P1IN ;push button is LOW on push jz set_lights bic.b #BIT0|BIT6, &P1OUT jmp check_btn set_lights: bis.b #BIT0|BIT6, &P1OUT Any problem with this code? Family Users Guide p 328 Blue Book pp 38

Example Program Input was FLOATING! Low is ground, High is floating, so use a pull- _________? 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 Modify code to toggle the LEDs when button is pressed (i.e. one LED on and one off)

Copyright © 2013 Elsevier Inc. All rights reserved. Why Pullup and Pulldown Resistors are needed Voltage Levels and Noise Margins Figure 1.23 Logic levels and noise margins Copyright © 2013 Elsevier Inc. All rights reserved.

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

Inclass Exercise 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