1 / 32

UNIT-6

UNIT-6. INTRODUCTION. POLLING INTERRUPTS INTERRUPT SERVICE ROUTINR(ISR). INTERRUPT STRUCTURE OF 8086. SUPPORTS 256 INTERRUPTS SOURCES OF INTERRUPTS INTERRUPT FROM EXTERNAL SIGNAL APPLIED TO TWO HARDWARE PINS INTR AND NMI (HARDWARE INTERRUPTS

loki
Download Presentation

UNIT-6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UNIT-6

  2. INTRODUCTION • POLLING • INTERRUPTS • INTERRUPT SERVICE ROUTINR(ISR)

  3. INTERRUPT STRUCTURE OF 8086 • SUPPORTS 256 INTERRUPTS • SOURCES OF INTERRUPTS • INTERRUPT FROM EXTERNAL SIGNAL APPLIED TO TWO HARDWARE PINS INTR AND NMI (HARDWARE INTERRUPTS • INTERRUPT GENERATED BY EXECUTING AN INTERRUPT INSTRUCTION S/W OR INTERNAL INTERRUPT • INTERRUPT BY AN ERROR CONDITION PRODUCED BY EXECUTING AN INSTRUCTION (INTERNAL ERRORS)

  4. INTERRUPT RESPONSE • 8086 COMPLETES THE EXECUTION OF CURRENT INSTRUCTION • CHECKS THE SOURCE OF INTERRUPT. • IF IT IS DUE TO INTR GO TO NEXT STEP ELSE GO TO STEP 5 • CHECKS THE INTERRUPT FLAG.IF ITS SET GO TO NEXT STEP ELSE • EXECUTE NEXT INSTRUCTION • _____ • 4. IT ACKS INTRRUPT BY SENDING INTA SIGNAL TO THE DEVICE. _____ • IT READS INTERRUPT TYPE GIVEN BY THE DEVICE DURING SECOND INTA SIGNAL • IT PUSHES THE FLAG REGISTER TO STACK AND DECREMENTS STACK POINTER BY 2 • IT CLEARS INTERRUPT FLAG AND TRAP FLAG • IT SAVES RETURN ADDRESS BY PUSHING THE CS,DEC SP BY 2,PUSH IP TO STACK,DEC SP BY 2 • TRANSFERS CONTROL TO START OF ISR. ADDRESS OF ISR IS TAKEN FROM IVT • BASED ON WHICH OF THE 256 INTERRUPTS IS SERVICED • AT THE END OF ISR, IRET HAS TO BE EXECUTED • POPS IP INC SP BY 2,POPS CS,INC SP BY 2 • 11. IT POPS EFLAGS INC SP BY 2 • 12. TRANSFERS CONTROL BACK TO THE PROGRAM WHICH WAS INTERRUPTED

  5. FLOWCAHRT FOR INTERRUPT RESPONSE SEQUENCE MAIN PROGRAM INTERRUPT IS DUE TO INTR PUSH EFLAGS CLEAR IF & TF PUSH CS &IP GO TO ISR NO YES NO IF =1 ISR YES INTERRUPT ACK CYCLE READ INTERRUPT TYPE POP IP POP CS POP FLAG REGISTER IRET

  6. INTERRUPT VECTOR TABLE

  7. 8086 INTERRUPT TYPES 256 INTERRUPTS OF 8086 ARE DIVIDED IN TO 3 GROUPS • TYPE 0 TO TYPE 4 INTERRUPTS- • THESE ARE USED FOR FIXED OPERATIONS AND • HENCE ARE CALLED DEDICATED INTERRUPTS • TYPE 5 TO TYPE 31 INTERRUPTS • NOT USED BY 8086,RESERVED FOR HIGHER PROCESSORS LIKE 80286 • 80386 ETC • TYPE 32 TO 255 INTERRUPTS • AVAILABLE FOR USER,CALLED USER DEFINED INTERRUPTS • THESE CAN BE H/W INTERRUPTS AND ACTIVATED THROUGH INTR LINE • OR CAN BE S/W INTERRUPTS

  8. TYPE – 0 DIVIDE ERROR INTERRUPT QUOTIENT IS LARGE CANT BE FIT IN AL/AX OR DIVIDE BY ZERO TYPE –1 SINGLE STEP INTERRUPT USED FOR EXECUTING THE PROGRAM IN SINGLE STEP MODE BY SETTING TRAP FLAG TO SET TRAP FLAG PUSHF MOV BP,SP OR [BP+0],0100H;SET BIT8 POPF TYPE – 2 NON MASKABLE INTERRUPT THIS INTERRUPT IS USED FOR EXECUTING ISR OF NMI PIN (POSITIVE EGDE SIGNAL). NMI CANT BE MASKED BY S/W TYPE – 3 BREAK POINT INTERRUPT USED FOR PROVIDING BREAK POINTS IN THE PROGRAM TYPE – 4 OVER FLOW INTERRUPT USED TO HANDLE ANY OVERFLOW ERROR AFTER SIGNED ARITHMETIC

  9. PRIORITY OF INTERRUPTS

  10. DOS INTERRUPTS 1. FUNCTION CALL 01: READ THE KEY BOARD INPUT PARAMETER AH = 01 READ A CHARACTER FROM KEYBOARD. ECHO IT ON CRO SCREENAND RETURN THE ASCII CODE OF THE KEY PRESSEDIN AL OUTPUT PARAMETER: AL = ASCII CODE OF CHARACTER 2. FUNCTION CALL 02H: DISPLAY ON CRT SCREEN INPUT PARAMETER: AH = 02 DL = ASCII CHARACTER TO BE DISPLAYED ON CRT SCREEN 3. FUNCTION CALL 03: READ CHARACTER FROM COM1 INPUT PARAMETER: AH = 03H FUNCTION: READS DATA FROM COM PORT OUTPUT PARAMETER: AL = ASCII CODE OF CHARACTER 4. FUNCTION CALL 04: WRITE CHARACTER TO COM1 INPUT PARAMETER: AH = 04H DL = ASCII CODE OF CHARACTER TO BE TRANSMITTED FUNCTION: WRITES DATA TO COM PORT 4. FUNCTION CALL 05: WRITE TO LPT1 INPUT PARAMETER: Al = 05H DL = ASCII CODE OF CHARACTER TO BE PRINTTED FUNCTION: PRINT THE CHARACTER AVAILABLE IN DL ON PRINTER ATTACHED TO LPT1

  11. DOS INTERRUPTS FUNCTION CALL 09: DISPLAY A CHARACTER STRING INPUT PARAMETER: AH = 09,DS:DX= ADDRESS OF CHARACTER STRING FUNCTION: DISPLAYS THE CHARACTERS AVAILABLE IN THE STRING TO CRT TILL A $ FUNCTION CALL 0AH: BUFFERED KEY BOARD INPUT INPUT PARAMETER: AH = 0AH DS:DX = ADDRESS OF KEYBOARD INPUT BUFFER FUNCTION: THE ASCII CODES OF THE CHARACTERS RECEIVED FROM KEYBOARD ARE STORED IN KEYBOARD BUFFER FROM 3RD BYTE. 1ST BYTE OF BUFFER = SIZE OF BUFFER UPTO 255. IT RECEIVES THE CHARACTERS TILL SPECIFIED NO.OF CHARACTERS ARE RECEIVED OR ENTER KEY IS PRESSES WHICH EVER IS EARLIER

  12. BIOS INTERRUPTS • INT 10H: VIDEO SERVICE INPERRUPT • IT CONTROLS THE VEDIO DISPLAY • FUNCTION CALL 00: SELECT VEDIO MODE • INPUT PARAMETER: AL = MODE NUMBER • AH = 00H • FUNCTION: IT CHANGES THE DISPLAY MODE AND CLEARS THE SCREEN • AL = 00 40 X 25 BLACK AND WHITE • AL = 04 320 X 200 COLOR • AL = 10H 640 X 350 X 16 COLOR • (b) FUNCTION CALL 03: READ CURSOR POSITION • INPUT PARAMETER: AH = 03 • BH = PAGE NUMBER • FUNCTION: READS CURSOR POSITION ON SCREEN • OUTPUT PARAMETERS: CH = STARTING LINE • CL = ENDING LINE • DH = CURRENT ROW • DL = CURRENT COLUMN

  13. BIOS INTERRUPTS • ( C) FUNCTION CALL 0E: WRITE CHARACTER ON CRT SCREEN AND ADVANCE CURSOR • INPUT PARAMETER: AH = 0EH • AL = ASCII CODE OF THE CHARACTER • BH = PAGE(TEXT MODE) • BL = COLOR(GRAPHICS) • FUNCTION: DISPLAY CHARACTER AVAILABLE IN AL ON SCREEN • INT 11H: DETERMINE THE TYPE OF EQUIPMENT INSTALLED. REGISTER AX SHOULD CONTAIN FFFFH AND INSTRUCTION INT 11H TO BE EXECUTED. ON RETURN, REGISTER AX WILL INDICATE THE EQUIPMENTS ATTACHED TO COMPUTER • INT 14H: CONTROL THE SERIAL COMMUNICATION PORT ATTACHED TO THE COMPUETR. AH SHOULD CONTAIN THE FUNCTION CALL • FUNCTION CALL 00:INITIALIZE THE COM PORT • FUNCTION CALL 01: SEND A CHARACTER • FUNCTION CALL 02:RECEIVE A CHARACTER • INT 16H: KEYBOARD INTERRUPT • AH SHOULD CONTAIN THE FUNCTION CALL • FUNCTION CALL 00: READ KEYBOARD CHARACTER, IT WILL RETURN ASCII CODE OF THE CHARACTER • FUNCTION CALL 01: GET KEY BOARD STATUS

  14. 8259

  15. Control Word (initialization)

  16. SEQUENCE OF OPERATIONS • IF IF FLAG IS SET AND INTR BECOMES ACTIVE HIGH • 8086 DOES THE FOLLOWING • 8086 pulses INTA(active low) twice indicating to 8259 that interrupt occurred • 8259 WILL SEND THE TYPE NO. OF HIGHEST PRIORITY INTERRUPT • TO 8086 ON D0-D7 LINES DURING 2ND INTA PULSE(ACTIVE LOW) • 3. 8086 MULTIPLIES THIS TYPE NO. 4 AND GETS THE CORRESPONDING • ADDRESS FROM IVT • 8086 PUSHED FLAG REGISTER,CLEARS IF,TF,PUSHED RET.ADDR • AND THEN EXECUTES THE ISR AT THE ADDRESS RECEIVED

  17. SEQUENCE OF OPERATIONS IN 8259 BEFORE IT • ACTIVATES INTR • THE IRR REGISTERS THE INTERRUPT REQUESTS • PRIORITY RESOLVER INTERACTS WITH IRR,ISR,IMR. IN CASE OF MULTIPLE • INTERRUPTS HIGHEST PRIORITY INTERRUPT IS PICKED UP • CORRESPONDING BIT IN IMR IS CHECKED BY PR TO SEE IF THIS • INTERRUPT CAN BE ALLOWED OR NOT, ASSUME THAT IT IS ALLOWED • ISR IS NOW CHECKED TO SEE IF ANY INTERRUPT IS UNDER SERVICE • IF A HIGHER PRI.INTR IS UNDER SERVICE PR TAKES NO ACTION. IF NO • HIGHER PRI.INTR IS UNDER SERVICE,IT ACTIVATES INT WHICH IS • CONNECTED TO INTR OF 8086 • 5. 8086 SENDS 2 INTA PULSES. USING 1ST PULSE 8259 WILL RESET THE CORRES • PONDING IR BIT OF IRR TO INDICATE THE REQ IS ACCEPTED AND SETS THE • CORRESPONDING IS BIT OF ISR TO INDICATE WHICH IR LEVEL IS UNDER • SERVICE • DURING 2NDINTA PULSE 8259 WILL SEND THE TYPE NUMBER OF INTERRUPT • ISR BIT WILL BE RESET AT THE END OF INT.SERVICE ROUTINE

  18. PRIORITY MODES FULLY NESTED MODE DEFAULT MODE. IR0 HAS HIG.PRI,IR1 NEXT ….IR7 LOWEST PRIORITY SPECIFIC ROTATION MODE AN IR WILL BE ASSIGNED LOWEST PRIORITY, THUS FIXING THE PRI OF OTHER INTERRUPTS IN CYCLIC MANNER EX: IF IR3 IS ASSIGNED LOWEST PRI., THEN IR2 IS NEXT HIGHER….IR4 IS HIGHEST PRI AUTOMATIC ROTATION MODE AN IR LEVEL AFTER BEING SERVICED GETS LOWEST PRIORITY, OTHER PRI WILL GET FIXED IN CYCLIC ORDER. EX: IR5 AFTER BEING SERVICED ASSIGNED LOWEST PRI,NEXT HIGHR WILL BE IR4,IR6 WILL BE HIGHEST SPECIAL FULLY NESTED MODE APPLICABLE FOR CASCADE CONFIGURATON.PRI.LEVEL OF SLAVE 8259 IS SAME FOR ALL INTERRUPTS. SO IF AN INTERRUPT IS UNDER SERVICE FROM A SLAVE THEN OTHER INTERRUPTS FROM SLAVE WILL NOT BE RECOGNISED. SFNM REMOVES THIS PROBLEM, ALLOWS HIGHEST PRI. INTERRUPT FROM A SLAVE TO BE RECOGNISED WHILE ANOTHET LOWER PRI INTERRUPT IS UNDER SERVICE

  19. END OF INTERRUPTS AUTOMATIC EOI EOI COMMAND NEED NOT BE GIVEN. ISR IS RESET BY LAST INTA PULSE. THE DRAWBACK IS THAT NOW ANY IR CAN INTERRUPT ISR. THIS METHOD IS GENERALLY USED WHEN A NESTED MULTI-LEVEL INTERRUPT STRUCTURE IS NOT REQUIRED. IT IS A PREFERRED MODE OF OPERATION AND REDUCES ISR LENGTH NON SPECIFIC EOI COMMAND THIS COMMAND WILL RESET THE HIGHEST PRIORITY ISR BIT. THIS IS BECAUSE IN NESTED MODE IT IS THE HIGHEST PRIORITY WHICH WILL BE IN SERVICE SPECIFIC EOI THIS COMMAND WILL RESET THE ISR BIT WHICH IS SPECIFIED AS A PART OF COMMAND. THREE BIT CODE L0 – L2 SPECIFIES WHICH BIT HAS TO BE RESET

  20. ICW-INITIALIZATION COMMAND WORD THERE ARE 4 ICWs ICW1 IS WRITTEN USING PORT0 ADDRESS OF 8259 ICW2 IS WRITTEN USING PORT1 ADDRESS OF 8259 It is used by 8086 to specify the interrupt type number which is sent by 8259 in response to INTA

  21. ICW1, ICW2

  22. D0-D7 ARE LABLED AS A8 TO A15(A8 – A15) OF INTERRYPT VECTOR ADDRESS AND USED BY 8085 D0 – D2 ARE NOT USED BY 8086 D3 – D7 ARE LABLED AS T3-T7(OF INTERRUPT VECTOR TYPE,USED BY 8086 AND ARE 5 MSBs OF INTERRUPT TYPE NUMBER

  23. Masking and Prioritization • OCW (operation command word)

  24. Programming OCWs

  25. OCW1 IS WRITTEN USING PORT1 ADDRESS OF 8259 IT IS USED TO SET RESET THE MASK BITS IN INTERRUPT MASK REGISTER D0 = 1 INDICATES IR0 IS MAKED OR DISABLED D0 = 0 INDICATES IR0 IS UNMASKED OR ENABLED D1 THROUGH D7 ARE FOR IR1 THROUGH IR7 OCW2 IS WRITTEN USING PORT 0 ADDRESS OF 8259 IT IS PROGRAMMED ONLY WHEN AEOI MODE IS NOT SELECTED IN ICW4 R- ROTATION SL-SPECIFIC LEVEL EOI – END OF INTERRUPT

  26. OCW3

More Related