Signal Name Direction w.r.t. Printer Function Summary Pin# (25-DB) CPU

Slides:



Advertisements
Similar presentations
I/O Organization popo.
Advertisements

Computer Architecture
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Programmable Interval Timer
I/O Unit.
I/O Subsystem Organization and Interfacing Cs 147 Peter Nguyen
Input / Output CS 537 – Introduction to Operating Systems.
Chapter 8 Input/Output l I/O basics l Keyboard input l Monitor output l Interrupt driven I/O l DMA.
System Calls 1.
MICROPROCESSOR INPUT/OUTPUT
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 2.
8279 KEYBOARD AND DISPLAY INTERFACING
ELE22MIC Lecture 8 ASll Examples –16 Bit Counters –Buffalo Jump Table Interrupt processing (IRQ/RTI) Stack Frame & Base Pointer Wired OR.
PPI-8255.
8279 KEYBOARD AND DISPLAY INTERFACING
Computer Architecture Lecture – 4.  Discussed individual functional units of the computer.  But to form a fully computational unit, they must be connected.
Basic LED Interface.
IT3002 Computer Architecture
I/O Organization Competency – C6. Important facts to remember when I/O devices are to be connected to CPU There is a vast variety of I/O devices. Some.
بسم الله الرحمن الرحيم MEMORY AND I/O.
The 8085 Microprocessor Architecture. What 8085 meant for? 80 - year of invention bit processor 5 - uses +5V for power.
1 load [2], [9] Transfer contents of memory location 9 to memory location 2. Illegal instruction.
CS501 Advanced Computer Architecture Lecture 29 Dr.Noor Muhammad Sheikh.
SRC: instruction formats Op-coderarb rc c Type D Op-code Type Aunused Op-codera Type Bc1 21 Op-coderarb.
STUDY OF PIC MICROCONTROLLERS.. Design Flow C CODE Hex File Assembly Code Compiler Assembler Chip Programming.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Serial mode of data transfer
The 8085 Microprocessor Architecture
Device Identification
CS501 Advanced Computer Architecture
Computer System Structures
Homework Reading Machine Projects Labs
Programming the I/O Hardware
Operating Systems (CS 340 D)
The deadline establish a priority among interrupt requests.
Direct Memory address and 8237 dma controller LECTURE 6
Interrupts In 8085 and 8086.
Input/Output.
Serial I/O and Data Communication.
Assembly Language for Intel-Based Computers, 5th Edition
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
Dr. Michael Nasief Lecture 2
DMA CONTROLLER 8257 Features: It is a 4-channel DMA.
E3165 DIGITAL ELECTRONIC SYSTEM
CS703 - Advanced Operating Systems
Overview Peripheral Devices Input-Output Interface
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
8259 Chip The Intel 8259 is a family of Programmable Interrupt Controllers (PIC) designed and developed for use with the Intel 8085 and Intel 8086 microprocessors.
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Falcon-E : Introduction
Programming the I/O Hardware
PROGRAMMABLE PERIPHERAL INTERFACE -8255
By: A. H. Abdul Hafez CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU
Computer System Overview
8086 Ahad.
Parallel communication interface 8255
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Programmer’s View of the EAGLE
COMPUTER PERIPHERALS AND INTERFACES
BLOCK DIAGRAM OF AN ADDRESS
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Computer Architecture and Assembly Language
The 8085 Microprocessor Architecture
8279 – Programmable Keyboard/Display Interface
CS501 Advanced Computer Architecture
Problem: Consider the following two SRC code segments for implementing multiplication. Find which one is more efficient in terms of instruction count and.
The Programmable Peripheral Interface (8255A)
Presentation transcript:

Signal Name Direction w.r.t. Printer Function Summary Pin# (25-DB) CPU side (36-DB) Printer D<7..0> Input 8-bit data bus 9,8,…,2 STROBE# 1-bit control signal High: default value. Low: read-in of data is performed. 1 ACKNLG# Output 1-bit status signal Low: data has been received and the printer is ready to accept new data. 10 BUSY Low: default value High: see note#1 11 PE# High: the printer is out of paper. Low: default value. 12 INIT# Low: the printer controller is reset to its initial state and the print buffer is cleared. 16 31 SLCT High: the printer is in selected state. 13 AUTO FEED XT# Low: paper is automatically fed after one line. 14 SLCT IN# Low: data entry to the printer is possible. High: data entry to printer is not possible. 17 36 ERROR# Low: see note#2. 15 32

CS501 Advanced Computer Architecture Lecture26 Dr.Noor Muhammad Sheikh

Centronics Bit Assignment for the I/O Ports Logical Address Description 7 6 5 4 3 2 1 8-bit output port for DATA D<7> D<6> D<5> D<4> D<3> D<2> D<1> D<0> 8-bit input port for STATUS BUSY ACKNLG# PE# SLCT ERROR# Unused 8-bit output port for CONTROL DIR IRQEN SLCT IN# INIT# Auto Feed XT# STROBE#

Problem Statement Assuming that a Centronics parallel printer is interfaced to the FALCON-A processor, as shown in example 9-4, write an assembly language program to send an 80 character line to the printer. Assume that the line of characters is stored in the memory starting at address 1024.

movi r1, reset ;use r1 for ;data transfer out r1, controlp

Polling loop again: in r1, statusp ; and r1,r1,r3 ; test if BUSY = 1 jnz r1, [again] ; wait if BUSY = 1

; filename: Example_11-8.asmfa ;This program sends an 80 character line ;to a FALCON-A parallel printer ; Notes: ; 1. 8-bit printer data bus connected to ; D<7..0> of the FALCON-A (remember big-endian) ; Thus, the printer actually uses addresses 57, 59 & 61 ; 2. one character per 16-bits of data xfered .org 400 NOB: .equ 80 movi r5, 32 mul r5, r5, r5 ; r5 holds 1024 temporarily movi r3, 1 shiftl r3,r3,7 ; to set mask to 0080h

datap: .equ 56 statusp: .equ 58 controlp: .equ 60 ; reset: .equ 1 ; used to set unidirectional, no interrupts, ; auto line feed, and strobe high strb_H: .equ 5 strb_L: .equ 4 movi r1, reset ; use r1 for data xfer out r1, controlp movi r7, NOB ; use r7 as character counter

again: in r1, statusp ; and r1,r1,r3 ; test if BUSY = 1 ? jnz r1, [again] ; wait if BUSY = 1 load r1, [r5] out r1, datap movi r1, strb_L out r1, controlp movi r1, strb_H addi r5, r5, 2 subi r7, r7, 1 jnz r7, [again] halt

; again: in r1, statusp [3] and r1 , r1, r3 [3] jnz r1, [again] [4] movi r7, NOB [2] ; again: in r1, statusp [3] and r1 , r1, r3 [3] jnz r1, [again] [4] load r1, [r5] [5] out r1, datap [3] movi r1, strob_L [2] out r1, controlp [3] movi r1, s trob_H [2] addi r5, r5, 2 [3] subi r7, r7, 1 [3] jnz r7, [again] [4] halt

Consider the following instructions: movi r1, strb_L [2] out r1, controlp [3] The execution time for these two instructions is 2+3 = 5 clock periods.

load r1, [r5] [5] out r1, datap [3] The execution time for these two instructions is 5+3 = 8 clock periods.

movi strb_H [2] out r1, controlp [3] The execution time for these two instructions is 2+3 = 5 clock periods.

Polling Loop again: in r1, statusp [3] and r1, r1, r3 [3] jnz r1, [again] [4] The execution time required by the polling loop is 3+3+4 = 10 clock periods.

Time required by polling loop The polling loop takes 10 clock cycles. For a 10MHz FALCON-A CPU, this is 10x100=1s One pass of the main loop =3+3+4+5+3+2+3+2+3+3+3+4 =38 clock cycles Hence 38x100=3.8 s

Efficiency of polling Assuming a 1000 character per second printer connected to FALCON-A CPU, 1character is printed every 1000 s. Hence the CPU will wait for 1000-3.8996 s before sending the next character. Thus the poling loop will be executed about 996 times for every character which is very inefficient.

Buffer A small memory inside the printer CPU interacts with printer through buffer Buffer relieves the CPU to perform other tasks while the printer is busy

Example Assume a 64 byte FIFO buffer inside a 1000 cps printer Time required to print a character is 1ms.

Modified program code again: in r1, statusp [3] and r1 , r1, r3 [3] jnz r1, [again] [4] ; load r1, [r5] [5] out r1, datap [3] addi r5, r5, 2 [3] subi r7, r7, 1 [3] jnz r7, [again] [4]

Program execution time Polling loop still takes 10 clock periods or 1 s. The main loop of the program is executed in 3+3+4+5+3+3+3+4=28 clock cycles. For a 10MHz FALCON-A CPU, 28x100=2.8 s

Efficiency of polling The outer loop will execute 64 times before the BUSY signal goes to 1. After that the polling loop will execute for about 996 times before BUSY goes to 0.

Using a larger buffer Cost of printer will increase Same situation arises after the buffer is filled up

Output register COUT = FFFFF114H Status register COSTAT = FFFFF110H

Wait: ld r1, COSTAT ;Read device status register, lar r3, Wait ;Set branch target for wait. ldr r2, Char ;Get character for output. Wait: ld r1, COSTAT ;Read device status register, brpl r3, r1 ;Branch to Wait if not ready. st r2, COUT ;Output character and start device.

Output Register LOUT = FFFFF134H Status Register LSTAT = FFFFF130H Unused Print Line Command Register LCMD = FFFFF138H

lar r1, Buff ;Set pointer to character buffer. la r2, 80 ;Initialize character counter and lar r3, Wait ; branch target. Wait: ld r0, LSTAT ;Read Ready bit, brpl r3, r0 ; test, and repeat if not ready. ld r0, 0(r1) ;Get next character from buffer, st r0, LOUT ; and send to printer. addi r1, r1, 4 ;Advance character pointer, and addi r2, r2, -1 ; count character. brnz r3, r2 ;If not last, go wait on ready. la r0, 1 ;Get a print line command, st r0, LCMD ; and send it to the printer.

Buff = Pointer to character Buffer. Two nested loops starting at the label Wait: 1). The two instruction inner loop, which waits for Ready. 2). The outer seven-instruction loop.

The outer seven-instruction loop perform following tasks: Outputs a character Advance the buffer pointer Decrement the register containing the number of characters left to print Repeat if there are more characters left to send. The last two instructions issue the command to print the line.

Instruction count Total instruction count to print a line =3+(80x7)+2 =565 instructions

Figure 8.9 (jordan) Program fragment to print 80 line character

Figure 8.8 (jordan) Program fragment for character output

Review

Start: la r2, 0 ;Point to first device, and la r3, 1 ; set all inactive flag. Check: ld r0,Done(r2) ;See if device still active, and brmi r4, r0 ; if not, go advance to next device. ld r3, 0 ;Clear the all inactive flag. ld r0,CICTL(r2) ;Get device ready flag, and brpl r4, r0 ; go advance to next if not ready. ld r0,CIN(r2) ;Get character and ld r1,Bufp(r2) ; correct buffer pointer, and st r0, 0(r1) ; store character in buffer. addi r1,r1,4 ;Advance character pointer, st r1,Bufp(r2) ; and return it to memory. addi r0,r0,-CR ;Check for carriage return, and brnz r4, r0 ; if not, go advance to next device. la r0, -1 ;Set done flag to -1 on st r0,Done(r2) ; detecting carriage return. Next: addi r2,r2,8 ;Advance device pointer, and addi r0,r2,-256 ; if not last device, brnz r5, r0 ; go check next one. brzr r6, r3 ;If a device is active, make a new pass.