final-review-3750-S06

final-review-3750-S06 - Review before final exam — EE...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Review before final exam — EE 3750 Interrupts, 82C55, 16550, 8259A Spring 2006 Example • • • • • Serial interface - Assume that 16550 is already initialized Parallel interface - Initialize 82C55, enable Group B interrupts Programmable interrupt controller - Initialize 8259A — interrupt requests from Group B on IR1 and from 16550 on IR2 Interrupt service routine — input via Port B of 82C55 and store in low array Interrupt service routine — input via 16550 and store in high array 2 data bus data Port A data 82C55 8086 data INTR INT INTA IR1 IR2 PC0 Port B STB IBF low input device INTA 8259 INTR 16550 data high input device SIN Initialize 82C55 78H is low port address Initialize Groups A and B in Mode 1; Port A - output; Port B - input Enable interrupts for Group B - by setting bit 2 of Port C PORTA EQU 78H ; Port A PORTB EQU 79H ; Port B CMD EQU 7BH ; Command register MOV AL, 10100110B OUT CMD, AL MOV AL, 00000101B OUT CMD, AL ; Modes, A output, B input ; set bit 2 of Port C 4 Initialize 8259A A0H is low port address Level-triggered interrupts, base interrupt type of 80H, no special fully nested mode, no buffered mode, AEOI mode disabled, mask all IR pins except IR1 and IR2 ICW1 EQU 0A0H ICW2 EQU 0A1H ICW4 EQU 0A1H OCW1 EQU 0A1H ; ICW 1 ; ICW 2 ; ICW 4 ; OCW 1 MOV AL, 00011011B ; level-triggered interrupts OUT ICW1, AL MOV AL, 80H ; base interrupt type of 80H OUT ICW2, AL MOV AL, 00000001B ; AEOI mode disabled OUT ICW4, AL MOV AL, 11111001B ; mask all IRs except IR1 and IR2 OUT OCW1, AL 5 Interrupt service routine—Port B Interrupt service routine to input to low array from Port B of 82C55. PTRLOW is word variable initialized to 0. OCW2 EQU 0A0H ; OCW 2 at even address ISRLOW PROC FAR PUSH BX ; save registers changed during ISR PUSH AX ; STI optional MOV BX, PTRLOW IN AL, PORTB MOV LOW[BX], AL ; store input in low INC PTRLOW ; update pointer MOV AL, 20H ; EOI command to 8259 OUT OCW2, AL POP AX POP BX IRET ISRLOW ENDP 6 Interrupt service routine—16550 PTRHIGH is word variable initialized to 0. SERDATA EQU 80H INTID EQU 82H ISRHIGH PROC FAR PUSH BX PUSH AX IN AL, INTID CMP AL, 4 JNE EXITH MOV BX, PTRHIGH IN AL, SERDATA MOV HIGH[BX], AL INC PTRHIGH MOV AL, 20H OUT OCW2, AL EXITH: POP AX POP BX IRET ISRHIGH ENDP ; data port address ends in 000 ; interrupt ID register address ends in 010 ; save registers changed during ISR ; STI optional ; check that interrupt because receiver ready ; store input in low ; update pointer ; EOI command to 8259 7 Compare int. serv. routines ISRLOW PROC FAR PUSH BX PUSH AX MOV BX, PTRLOW IN AL, PORTB MOV LOW[BX], AL INC PTRLOW MOV AL, 20H OUT OCW2, AL POP AX POP BX IRET ISRLOW ENDP ISRHIGH PROC FAR PUSH BX PUSH AX IN AL, INTID CMP AL, 4 JNE EXITH MOV BX, PTRHIGH IN AL, SERDATA MOV HIGH[BX], AL INC PTRHIGH MOV AL, 20H OUT OCW2, AL EXITH: POP AX POP BX IRET ISRHIGH ENDP 8 ...
View Full Document

This note was uploaded on 01/25/2012 for the course EE 3750 taught by Professor Desouza during the Fall '08 term at LSU.

Ask a homework question - tutors are online