Fri. Sept 29 Announcements

Slides:



Advertisements
Similar presentations
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Advertisements

PROGRAMMABLE PERIPHERAL INTERFACE -8255
9/20/6Lecture 3 - Instruction Set - Al Hardware interface (part 2)
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
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.
Embedded Network Interface (ENI). What is ENI? Embedded Network Interface Originally called DPO (Digital Product Option) card Printer without network.
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
PPI-8255.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Basic LED Interface.
IT3002 Computer Architecture
Circuit diagram for interfacing Common Anode 7-Segment Display.
The HCS12 SCI Subsystem A HCS12 device may have one or two serial communication interface. These two SCI interfaces are referred to as SCI0 and SCI1. The.
EEE /INSTR/CS F241 ES C263 Microprocessor Programming and Interfacing
Department of Computer Science and Engineering
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Chapter 6 Input/Output Organization
Serial mode of data transfer
Everybody.
I/O SYSTEMS MANAGEMENT Krishna Kumar Ahirwar ( )
Buffered, Interrupt-Driven Printer Design Example
For further information
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.
9S12C Multiplexed Bus Expansion
Chapter 11: Inter-Integrated Circuit (I2C) Interface
Chapter 10 Input/Output Organization
Presented By: Navneet Kaur Randhawa Lect. I.T. Deptt. GPC,Amritsar
Direct Memory address and 8237 dma controller LECTURE 6
Refer to Chapter 10 in the reference book
Diagram of microprocessor interface with IO devices
NS Training Hardware.
Wed. Sept 20 Announcements
Serial I/O and Data Communication.
COMP2121: Microprocessors and Interfacing
Buffered, Interrupt-Driven Printer Design Example
Lab Practical #1 Review Tim Rogers 2017.
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
Introduction to Microprocessors
COMP2121: Microprocessors and Interfacing
E3165 DIGITAL ELECTRONIC SYSTEM
Chapter 8 I/O.
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Computer Architecture
Module 2.E Buffered I/O Tim Rogers 2017.
Module 2.E Buffered I/O Tim Rogers 2017.
Interfacing Memory Interfacing.
Chapter 8 I/O.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
8255.
Serial Communication Interface: Using 8251
Parallel communication interface 8255
Programmable Interval timer 8253 / 8254
Operating Systems Chapter 5: Input/Output Management
Programmable Peripheral Interface
82C55 Programmable Peripheral Interface
Chapter 8 I/O.
Programmable Interval timer 8253 / 8254
Five Key Computer Components
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
Chapter 8 I/O.
Wireless Embedded Systems
ECE 352 Digital System Fundamentals
Jazan University, Jazan KSA
Chapter 13: I/O Systems.
The Programmable Peripheral Interface (8255A)
Presentation transcript:

Fri. Sept 29 Announcements HW/Lab 6 posted yesterday Lab 6 has been up (unchanged since the class began) Quiz on Module 2 (A+B) Monday Have video lectures almost done, will edit and post today

General-Purpose I/O Ports Module 2.C General-Purpose I/O Ports Tim Rogers 2017

Learning Outcome #2 Bus Timing Analysis “An ability to interface a microcontroller to various devices” Bus Timing Analysis 9S12C Multiplexed Bus Expansion General-Purpose I/O Ports Interrupt Handling Buffered I/O Buffered, Interrupt-Driven Printer Design Example How?

Complex interfaces are useful but… Objective “General Purpose I/O Ports” Why? 1 Complex interfaces are useful but… Sometimes, you just want to read/write 0’s and 1’s manually from software.

Overview Hardware Software How ports are initialize/used Basic Port Structure PIM Block user guide: https://engineering.purdue.edu/ece362/Refs/9S12C_Refs/S12C32PIMV1.pdf Software Write a simple driver for a printer, driven by GPIO (General-Purpose I/O)

Hardware Overview Ports on the 9S12 (some ports padded out to pins, some not) By default – they are used for GPIO Ports can also be used by other modules (peripherals) – we set configuration bits to make this happen. Can only be configured for either GPIO or the module (for example port E from lab 5). All this IO is digital I/O (meaning you can only read/write a 0 or a 1 on each bit).

Hardware Port Integration Module (PIM) PT0 + PT1: Connected to LEDs PAD6 + PAD7: Connected to pushbuttons Port P: Not padded out on your micro Ports A and B: Not padded out on your micro For 362, use PAD0-7, PT0-7 and PE0 + PE1 for GPIO. (as long as you aren’t using them for their other purpose)

Read or write the actual value from here. How to setup GPIO If DDRT (Port T’s DDR) is 11110000b. Will the CPU be able to write the value 70h to PTT (Port T’s GPIO value register)? A: Yes B: No C: Sort of… D: What? If DDRT (Port T’s DDR) is 11110000b. Will the CPU be able to write the value 70h to PTT (Port T’s GPIO value register? A: Yes B: No C: Sort of…  D: What? If DDRT (Port T’s DDR) is 00000000b. Will the CPU be able to write to PTT (Port T’s GPIO value register)? A: Yes B: No C: Sort of… D: What? If DDRT (Port T’s DDR) is 00000000b. Will the CPU be able to write to PTT (Port T’s GPIO value register)? A: Yes B: No C: Sort of… D: What? Need to tell it to be input or output “Data Direction Register” (DDR) specifies this. There is one of these for each port DDR Register (8-bits) Port Value Register (8-bits) DDR 7-0: 0 means port is an input 1 means port is an output PT 7-0: Read or write the actual value from here.

Also a “reduced drive” register RDR Register (8-bits) RDR 7-0: 0 means output “full drive” 1 means output “reduced drive” Reduced drive decreases power consumption and helps cut down on electromagnetic interference.

Pull Enable Bit / Polarity Select If the pin is an input, you can specify if the 9s12 pulls the pin up or down or lets it float. PE Register (8-bits) PS Register (8-bits) PE 7-0: 0 means pin float if undriven 1 means pin will be pull – look at PS to decide up or down PS 7-0: 0 means pin be pull-up device 1 means pin will be pull-down device

Block Diagram of Pin Functionality port input data (read) dual-rank input synchronizer port output data (write) external pin data direction register Note: If module/peripheral is enabled, it “takes over” the associated port pin(s) module/peripheral associated with port pin

Port timing Port data setup time = 120 ns hold time = 0 ns Port READ Timing Port write delay time = 40 ns Port Write Timing

Printer Interface Example Algorithm: Handshaking signals and communication protocols HW: Interface circuit and register initializations SW: Program-driven I/O device driver Analysis: Examination of timing for a printer

Handshaking and Communication Protocol In general, the maximum transfer rate of which an I/O device is capable does not match the maximum transfer rate of which the CPU is capable Communication (or synchronization) between an I/O device and CPU is therefore required for reliable data transfer, using handshaking signals signal from computer to I/O Device: DATA AVAILABLE or STROBE signal from I/O device to computer: BUSY or READY

Handshaking and Communication Protocol The sequence in which these signals are asserted and negated with respect to the data transfer is referred to as the communication protocol Example: Handshaking signals and communication protocol for a generic (parallel port) printer STROBE: “I have the next ASCII character available for you to print” BUSY: “I’m currently printing the previous character you sent me (or something ‘bad’ has happened), so please don’t send me any more right now”

Handshaking and Communication Protocol Data Printer STROBE BUSY

Handshaking and Communication Protocol STROBE 1 BUSY Previous Character DATA STEP 1: Check to see if the printer is busy

Handshaking and Communication Protocol STROBE 1 BUSY 2 Previous Character Next Character DATA STEP 2: Send data to printer

Handshaking and Communication Protocol 3 STROBE 1 BUSY 2 Previous Character Next Character DATA STEP 3: CPU asserts STROBE signal

Handshaking and Communication Protocol 3 4 STROBE 1 BUSY 2 Previous Character Next Character DATA STEP 4: Printer asserts BUSY while printing

Handshaking and Communication Protocol 3 4 STROBE 1 5 BUSY 2 Previous Character Next Character DATA STEP 5: Printer negates BUSY when print cycle is complete

Printer Port Timing

Printer-Microcontroller Interface …where Port X and Port Y are any available port pins Port X (bits 0-7) Printer STROBE (Port Y, bit 1) BUSY (Port Y, bit 0)

Register Initializations

Register Initializations

Register Initializations

Register Initializations

Register Initializations

Program-Driven I/O

Program-Driven I/O read device status

Program-Driven I/O read device status is device ready?

Program-Driven I/O read device status is device ready? no

Program-Driven I/O read device status is device ready? no yes transfer data

Program-Driven Device Driver A device driver is a low-level routine that transfers data to/from an I/O device and generates any handshaking protocol required The printer device driver pchar functions as follows: checks printer status and waits if the printer is busy transfers the character passed in the A register to the printer strobes the printer

Printer Initialization Routine bmask equ $01 ; BUSY bit mask smask equ $02 ; STROBE mask pinit

Printer Initialization Routine bmask equ $01 ; BUSY bit mask smask equ $02 ; STROBE mask pinit movb #$FF,ddrx

Printer Initialization Routine bmask equ $01 ; BUSY bit mask smask equ $02 ; STROBE mask pinit movb #$FF,ddrx movb #$02,ddry

Printer Initialization Routine bmask equ $01 ; BUSY bit mask smask equ $02 ; STROBE mask pinit movb #$FF,ddrx movb #$02,ddry bset porty,smask rts

Assume character to print in (A) Printer Device Driver bmask equ $01 ; BUSY bit mask smask equ $02 ; STROBE mask pchar pshc pwait staa portx pulc rts Assume character to print in (A)

Spin loop, waits until busy is set. Printer Device Driver bmask equ $01 ; BUSY bit mask smask equ $02 ; STROBE mask pchar pshc pwait brset porty,bmask,pwait staa portx pulc rts Spin loop, waits until busy is set.

Printer Device Driver bmask equ $01 ; BUSY bit mask smask equ $02 ; STROBE mask pchar pshc pwait brset porty,bmask,pwait staa portx bclr porty,smask ; 4 cycles pulc rts Sets Strobe Low

Sets strobe back to high Printer Device Driver bmask equ $01 ; BUSY bit mask smask equ $02 ; STROBE mask pchar pshc pwait brset porty,bmask,pwait staa portx bclr porty,smask ; 4 cycles bset porty,smask ; 4 cycles pulc rts Sets strobe back to high

Printer Port Timing Analysis Assume 8 MHz Bus Clock  125 ns/cycle STROBE duration = 4 cycles X 125 ns/cycle = 500 ns STROBE asserted 4 cycles X 125 ns/cycle = 500 ns following STAA