ECE 3561 - Lecture 1 1 L15 – Digital I/O Department of Electrical and Computer Engineering The Ohio State University ECE 2560.

Slides:



Advertisements
Similar presentations
Chapter 6 General Purpose Input/Output
Advertisements

PROGRAMMABLE PERIPHERAL INTERFACE -8255
Code Composer Department of Electrical and Computer Engineering
Chung-Ta King National Tsing Hua University
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
Introduction of Holtek HT-46 series MCU
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
Interrupts (contd..) Multiple I/O devices may be connected to the processor and the memory via a bus. Some or all of these devices may be capable of generating.
Read Chapter 3 (David E. Simon, An Embedded Software Primer)
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
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
The MSP430xxxx Department of Electrical and Computer Engineering
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
ECE Lecture 1 1 Binary number system Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors.
DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1.
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
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.
System Clocks.
MICROPROCESSOR INPUT/OUTPUT
By, Prof. Tambe S. S. S.N.D. College of Engineering and Research Center Department of Electrical Engineering.
I NTRODUCTION P IN CONFIGARATION O PERATING MODE.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
ECE 447 Fall 2009 Lecture 10: TI MSP430 Timers and Capture Modes.
Lecture 11: TI MSP430 Timers Compare Modes
7/23 Interrupt Controller and Edge Port in Coldfire Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee.
Lecturers: Professor John Devlin Mr Robert Ross
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
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.
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
ECE 447 Fall 2009 Lecture 7: MSP430 Polling and Interrupts.
ECE Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Department of Electronic & Electrical Engineering Lecture 2 ● Introduction to IO ● Using a subroutine ● Driving a 7seg display.
Lecture 4 General-Purpose Input/Output NCHUEE 720A Lab Prof. Jichiang Tsai.
بسم الله الرحمن الرحيم MEMORY AND I/O.
ECE Lecture 1 1 The Hardware Multiplier Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
8255:Programmable Peripheral Interface
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Intel 8255A PPI EEE 365 [FALL 2014] LECTURE ATANU K SAHA BRAC UNIVERSITY.
EET 2261 Unit 13 Enhanced Capture Timer
Why are Timer Functions Important?
NFC Sensor System ECE Winter 2015
ECE 3430 – Intro to Microcomputer Systems
PROGRAMMABLE PERIPHERAL INTERFACE -8255
CS4101 嵌入式系統概論 General Purpose IO
ECE 3430 – Intro to Microcomputer Systems
Lecture 8: TI MSP430 Interrupts, ISRs
S04: MSP430 Microarchitecture
Chapter 6 General Purpose Input/Output
CS4101 Introduction to Embedded Systems Lab 1: General Purpose IO
Lesson Outline Peripherals Memory-Mapped IO Ports GPIO Multiplexing
CS4101 嵌入式系統概論 General Purpose IO
COMP2121: Microprocessors and Interfacing
The 8255 Programmable Peripheral Interface
Blinking an LED Using MSP430ware to Control GPIO
ECE 3430 – Intro to Microcomputer Systems
PROGRAMMABLE PERIPHERAL INTERFACE -8255
8255.
Final Exam Review Department of Electrical and Computer Engineering
ECE 3430 – Intro to Microcomputer Systems
CSCI1600: Embedded and Real Time Software
Lecture 9: TI MSP430 Interrupts & Low Power Modes
CSCI1600: Embedded and Real Time Software
ECE 3430 – Intro to Microcomputer Systems
CS4101 Introduction to Embedded Systems Lab 2: Basic IO and Timer
The Programmable Peripheral Interface (8255A)
Presentation transcript:

ECE Lecture 1 1 L15 – Digital I/O Department of Electrical and Computer Engineering The Ohio State University ECE 2560

Digital I/O on the 430 Digital input and output The ports Port setup The control registers Using a port ECE Lecture 1 2

The MSP 430 The MSP 430 is a microcontroller intended for use in embedded systems. As such, it needs to be capable of being connected with various input sensors and generating signal with control outputs. For a large number of these, digital I/O is appropriate. ECE Lecture 1 3

Digital I/O overview A MSP430 device may have up to 6 digital I/O ports, P1 through P6. Each port has 8 I/O pins. Pins are configurable for input or output direction and each I/O line can be individually read or written to. Ports P1 and P2 have interrupt capability with the interrupt for each I/O line individually enabled and configured. All P1 lines source a single interrupt vector P2 lines source a single interrupt vector (different than the vector for P1) ECE Lecture 1 4

Summary of features Digital I/O features Individually programmable I/Os Any combination of input or output Individually configurable P1 and P2 interrupts Independent input and output registers ECE Lecture 1 5

Digital I/O Digital I/O is configured with user software Done by setting the value in port control registers. Input register – a bit for each pin - PxIN Bit = 0 – The input is low Bit = 1 – The input is high Output register – the value to be output on the pin - PxOUT Bit = 0 – Set output low Bit = 1 – Set output high ECE Lecture 1 6

The control registers Direction Register PxDIR This register for a port sets the direction of each pin of the input/output port Bit = 0 – The port pin is set to input direction Bit = 1 – The port pin is set to output direction Function Select Register – PxSEL The ports can also be used with other peripheral devices according to the data sheet of the device. Or it is a simple I/O port. Bit = 0 – Set function to I/O Bit = 1 – Set peripheral function mode. ECE Lecture 1 7

Interrupt Control Register (cont) Interrupt Flag Registers P1IFG, P2IFG For ports 1 and 2 these registers record if an interrupt is present on the appropriate pin. Bit = 0 – No interrupt is pending Bit = 1 – Interrupt is pending Interrupt Edge Select Register P1IES, P2IES These registers select whether the interrupt occurs on a rising edge or falling edge. Interrupt Enable P1IE, P2IE Each P1IE bit enables the associated PxIFG interrupt flag. (1 = enabled, 0 = disabled) ECE Lecture 1 8

Unused Ports What to do with the pins for unused ports? Unused I/O pins should be configured as I/O function, output direction and left unconnected on the PC board. ECE Lecture 1 9

Register summary Port P1 REGISTER Name AddressType Input Register P1IN020hR Output Register P1OUT 021hR/W Direction Reg P1DIR022hR/W Interrupt Flag P1IFG023hR/W Intr Edge Select P1IES024hR/W Interrupt Enable P1IE025hR/W Port Select P1SEL026hR/W Internal Resistor P1REN 027hR/W ECE Lecture 1 10

Register summary Port P2 REGISTER Name AddressType Input Register P2IN028hR Output Register P2OUT 029hR/W Direction Reg P2DIR02AhR/W Interrupt Flag P2IFG02BhR/W Intr Edge Select P2IES02ChR/W Interrupt Enable P2IE02DhR/W Port Select P2SEL02EhR.W ECE Lecture 1 11

Port 3 and 4 Port P3 REGISTER Name AddressType Input Register P3IN 018hR Output Register P3OUT 019hR/W Direction Reg P3DIR 01AhR/W Port Select P3SEL 01BhR/W Port P4 REGISTER Name AddressType Input Register P4IN 01ChR Output Register P4OUT 01DhR/W Direction Reg P4DIR 01EhR/W Port Select P4SEL 01FhR/W ECE Lecture 1 12

Ports 5 and 6 Port P5 REGISTER Name AddressType Input Register P5IN 030hR Output Register P5OUT 031hR/W Direction Reg P5DIR 032hR/W Port Select P5SEL 033hR/W Port P6 REGISTER Name AddressType Input Register P6IN 034hR Output Register P6OUT 035hR/W Direction Reg P6DIR 036hR/W Port Select P6SEL 037hR/W ECE Lecture 1 13

EXAMPLE OF use On the launchpad there are 2 Light Emitting Diodes on the PC board These are (according to the notation on the board) at P1.0 and P1.6 Let’s turn then on and off ECE Lecture 1 14

The steps Configure the port Port 1 Configure the data direction register, P1DIR Located at address 022h Set value to 1 for output Desire pins 0 and 6 of the port as output so value to set is 1xxxxx1x or just set it to all 1s Instruction mov.b#0x0FF,P1DIR Configure the interrupt enables to disable Mov.b 0x00,P1IE ECE Lecture 1 15

A note on code composer As this MSP430 does have Port 1 the pneumonic labels such as P1OUT are defined in Code Composer. That is why they are commented out in the sample code. ECE Lecture 1 16

The code ; Set up the port mov.b #0xFF,P1DIR ;set P1 to outputs mov.b #0x00,P1IE ;disable interrupts mov.b #0x00,P1SEL ;all pins are I/O ; move values to the port mov.b #0x00,P1OUT mov.b #0x0F,P1OUT mov.b #0xF0,P1OUT ECE Lecture 1 17

A loop to toggle to output mov #0xFFFF,R6 ;# times to wait toldec R6 jne tol;busy wait mov.b P1OUT,R4 inv R4 mov.b R4,P1OUT jmp tol ECE Lecture 1 18

Notes on code Busy wait : a term applied to techniques to insert a timed wait into a program that performs no useful computation other than to wait for time to elapse or an event to occur. This toggles the leds based on time. The code to toggle them could be tuned to take slightly less cycles but that this not desired here. ECE Lecture 1 19

ECE Lecture 1 20 Summary - Assignment Try out the code Add an inner loop to lengthen the time for each individual light. No new assignment.