Lecture # 11.

Slides:



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

Lecture # 12. PIC Printer Interface Printer IRQ7 INT ACK Printer Interface.
©annax1 PC-technology Keyboard Graphics Interface cards.
8255 – PROGRAMMABLE PARALLEL
82C55 82C55 Programmable Peripheral Interface Interfacing Part III.
Flow Diagram: Push flags, CS, IP Pop IP,CS,flags Push AX,BX,CX,DX,ES,DS,SI,DI,BP POP BP,DI,SI,DS,ES,DX,CX,BX,AX.
CSS 372 Lecture 1 Course Overview: CSS 372 Web page Syllabus Lab Ettiquette Lab Report Format Review of CSS 371: Simple Computer Architecture Traps Interrupts.
EET Advanced Digital Parallel Ports. n In contrast to serial ports, parallel ports ‘present’ all bits at one time. n ‘The parallel port reflects.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Practical Session No. 10 Input &Output (I/O). I/O Devices Input/output (I/O) devices provide the means to interact with the “outside world”. An I/O device.
University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
CHAPTER 10 Keyboard and Printer Interfacing. Matrix Keyboard.
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
UNIT 8 Keypad Interface Contact Closure Counter Exceptions (Interrupts and Reset)
Lecture 9. - Synchronous Devices require a timing signal. Clock generated Interval Timer Microprocessor Interval Timer Clk PCLK = MHz PCLK (for.
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
ECE291 Computer Engineering II Lecture 9 Josh Potts University of Illinois at Urbana- Champaign.
Lecture 13 Basic I/O Interface
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
Another Example: #include<BIOS.H> #include<DOS.H>
Computers Internal Communication. Basic Computer System MAIN MEMORY ALUCNTL..... BUS CONTROLLER Processor I/O moduleInterconnections BUS Memory.
Applications of PPI A/D - Temperature Sensor. Analog to Digital.
ECE291 Computer Engineering II Lecture 12 Josh Potts University of Illinois at Urbana- Champaign.
PPI-8255.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
ECE291 Computer Engineering II Lecture 16 Josh Potts University of Illinois at Urbana- Champaign.
ROM BIOS Chapter 9. The ROM BIOS PC computer come with a set od built in routines collectively called the ROM BIOS. These routines are permanent part.
Comparison Instructions Test instruction –Performs an implied AND operation between each of the bits in 2 operands. Neither operand is modified. (Flags.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edit9on Lecture 3 Chapter 1: Introduction Provided & Updated by Sameer Akram.
Intel 8255A PPI EEE 365 [FALL 2014] LECTURE ATANU K SAHA BRAC UNIVERSITY.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Lecture 15. Modem Controller Register 4310 DTR 0 = Polling Operator 1 = Interrupts Enabled RTS 1 =Self Test 0 =Normal.
Computer Graphics Lecture 04 Point Taqdees A. Siddiqi
#include <dos. h> void interrupt(
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Signal Name Direction w.r.t. Printer Function Summary Pin# (25-DB) CPU
8279 Keyboard / Display Interface
Homework Reading Continue mp1 Labs Tokheim, Section 13-6 Questions?
MICROPROCESSOR BASED SYSTEM DESIGN
Microprocessor and Assembly Language
Programming the I/O Hardware
Computer Organization & Assembly Language Chapter 3
CS-401 Compute Architecture & Assembly Language Programming
E3165 DIGITAL ELECTRONIC SYSTEM
Overview Peripheral Devices Input-Output Interface
Example 21H/42H: handle = open("c:\\abc.txt",O_RDONLY);
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Physics 413 Chapter 10.
The slides must be understood in Lecture 5
CSCI 315 Operating Systems Design
Programming the I/O Hardware
I/O Interfacing CSE 2312 Maher Al-Khaiyat.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Instruction cycle Instruction: A command given to the microprocessor to perform an operation Program : A set of instructions given in a sequential.
8255.
Parallel communication interface 8255
Interrupt Mechanism Interrupt Compared With Procedures Call MyProc
Lecture 10.
Lecture 16.
Operating Systems Chapter 5: Input/Output Management
Programmable Peripheral Interface
82C55 Programmable Peripheral Interface
unsigned char far *scr=0xb ;
COMPUTER PERIPHERALS AND INTERFACES
Lecture 19.
Unit:08 Software Interrupts
CS-401 Computer Architecture & Assembly Language Programming
Lecture 17.
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

Lecture # 11

Programmable Peripheral Interface (PPI)

Programmable Peripheral Interface (PPI) Device Used as Parallel port Interface (I/O controller) is PPI

Programmable Peripheral Interface (PPI) CPU Parallel I/O Device Printer PPI

Accessing the Parallel Port Through BIOS Functions

Accessing the Parallel Port Through BIOS Functions INT 17H Services 00 Display Characters 01 Initialize Printer 02 Request Printer DX register Port Interface Number 0=LPT1,1=LPT2,2=LPT3

Accessing the Parallel Port Through BIOS Functions All the function Return in AH the Current Printer Status 7 6 5 4 3 2 1 Time out Printer Busy Receive Mode Selected Out of Paper Transfer Error Printer OffLine

Accessing the Parallel Port Through BIOS Functions Time Out Byte 0040:0078 LPT1 0040:0079 LPT2 0040:007A LPT3

Accessing the Parallel Port Through BIOS Functions Specify the number of Attempts BIOS perform before giving a time out Error This byte Varies Depending upon the speed of the PC Busy =0 Printer is Busy Busy =1 Printer is not Busy

Importance of the Status Byte

Importance of the Status Byte If((pstate&0x29)!=0)or ((pstate&0x80)==0) or ((pstate&0x10)==0) {printerok=FALSE;} else {printerok=TRUE;}

Importance of the Status Byte 17H/00H Write a character on entry AH=00 AL=ASCII code DX=Interface# On exit AH=Status Byte 17H/01H Initialize Printer on entry AH=01 DX=Interface# On exit AH=Status Byte 17H/02H Get Printer Status on entry AH=02, DX=Interface# On exit AH=Status Byte

Printing Program

Printing Program REGS regs; FILE *fptr; void main(void) { fptr=fopen(“c:\\temp\\abc.text”,”rb”); regs.h.ah=1; regs.x.dx=0; int86(0x17,&regs,&regs); while(!feof(fptr)) {regs.h.ah=2; if ((regs.h.ah & 0x80)==0x80) { regs.h.ah=0; regs.h.al=getc(fptr); }}}

Printing Program 1 #include <dos.h> void interrupt (*old)( ); void interrupt newint ( ); main( ) { old = getvect(0x17); setvect(0x17,newint); keep(0,1000); } void interrupt new () { if (_AH==0) if ((_AL>='A')&&(_AL<='Z')) return; (*old)();

Printing Program 2 #include <dos.h> void interrupt (*old)( ); void interrupt newfunc ( ); main( ) { old=getvect(0x17); setvect(0x17,newfunc); keep(0,1000); } void interrupt newfunc( ) if (_AH==0) if ( _AL != ‘ ‘ ) (*old)();

Printing Program 3 void interrupt (*old)( ); void interrupt newfunc ( ); main() { old=getvect(0x17); setvect(0x17,newfunc); keep(0,1000); } void interrupt newfunc ( ) { if ( _AH == 0 ) { (*old)(); _AH=0; else Printing Program 3

Direct Parallel Port Programming

Direct Parallel Port Programming BIOS support up to three parallel ports Address of these LPT ports is Stored in BIOS Data Area 40:08 word LPT1 40:0A LPT2 40:0C LPT3 40:0E LPT4

Direct Parallel Port Programming Dump File Text

Direct Parallel Port Programming unsigned int far * lpt = (unsigned int far *) 0x00400008 ; unsigned int temp; temp=*(lpt); *lpt=*(lpt + 1); *(lpt + 1)=temp;

Direct Parallel Port Programming Port Registers 40:08 store the base address for lpt1 The parallel port interface has 3 ports internally If the Base address is 0X378 then the three Ports will be 0x378,0x379 0x37A

Printer Data Port Base +0 = Data Port 7 6 5 4 3 2 1

Printer Status Register Base + 1 = Printer Status 7 6 5 4 3 2 1 0 Busy=0 ACK=0 PE=1 SL=1 ERR=0 Out of Paper Printer Online Printer is ready for Next Character Printer is Busy

Printer Control Register Printer Control Register = Base + 2 7 6 5 4 3 2 1 IRQ SI IN ALF ST IRQ ENABLE initialize Auto Line Field Execute Interrupt When ACK=0; STROB SELECT InLine Turn Computer on line

Direct Parallel Port Programming file *fptr; unsigned far *base=(unsigned int far *)0x00400008 void main ( ) { fptr=fopen(“c:\\abc.txt”,”rb”); while( ! feof (fptr) ) { if(( inport (*base + 1 ) & 0x80) == 0x80) outport(*base, getc(fptr)); outport((*base)+2, inport((*base+2) & 0xFE); outport((*base)+2, inport((*base+2) | 0x01); } }}