PIC &PPI PPI Mode 2 with PIC(8259).

Slides:



Advertisements
Similar presentations
Microprocessor Systems
Advertisements

8259 Programmable Interrupt Controller
DMA Controller (8237 Programming Examples)
A Design Example An Exact Calculator. Exact Calculator Manipulating Large Integer Values Operations: – +, -, *, /, %, And, Or, Xor, Not, Power Functions.
Interrupt Controller Introduction to 8259.
Digital Interfacing.
University of Tehran 1 Microprocessor System Design Interrupt Omid Fatemi
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
KMUTT: S. Srakaew Instructions Can Be Divided into 3 Classes Data movement instructions  Move data from a memory location or register to another memory.
Kip Irvine: Assembly Language for Intel-Based Computers Overview Stack Operations (PUSH and POP) Procedures Procedure Parameters Software Interrupts MS-DOS.
Homework / Exam Return and Review Exam #1 Reading Machine Projects
Microcomputer & Interfacing Lecture 3
8.4 Instruction Execution Times TOBIN PROC FAR SUB AX,AX MOV DX,AX MOV CX,4 NEXTD: PUSH CX SUB BP,BP MOV CX,4 GETNUM: RCL BX,1 RCL BP,1 LOOP GETNUM.
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.
Interrupts – (Chapter 12)
CPU Interfacing Memory.
Input/Output Interface Circuits and LSI Peripheral Devices
Khaled A. Al-Utaibi  Interrupts in Microcomputer Systems  Programmable Interrupt Controllers  General Description of the 8259A.
BIOS and DOS Programming in DOS INT 10 and 21H. Interrupts There are some extremely useful subroutines within BIOS or DOS that are available to the user.
PIT Programming Examples Working with the modes of PIT.
UNIT-6. INTRODUCTION  POLLING  INTERRUPTS  INTERRUPT SERVICE ROUTINR(ISR)
1 Microprocessor-based Systems Course 8 Design of input/output interfaces.
8086 has 2 interrupt inputs 1. NMI 2. INTR For application where we have interrupts from multiple sources, use an external device called a Priority Interrupt.
A Design Example The Exact Calculator Software. Control Word For Display = 89H.
Interrupts Useful in dealing with: The interface: Random processes;
Lecture 14 Basic I/O Interface Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Programmable Peripheral Interface Parallel port Interface 8255
EE3721 Computer System Principles
UNIT-IV 8255 PPI Various Modes Of Operation Interfacing To 8086.
A Design Example A Programmable Calculator. Programmable Calculator Working in Exact Mode Receiving Program from RS232 Port Saving Programs using RS232.
8086 Interrupts and Interrupt Applications
14.2: x86 PC AND INTERRUPT ASSIGNMENT
Block diagram of 8086.
ENEE 440 Chapter PPI 8255 Register Select -CS A1 A0 REGISTER R/W PORT A R/W PORT B R/W PORT C R/W CR W 1 X X8255 NOT.
University of Tehran 1 Microprocessor System Design Programmable Interrupt Controller Omid Fatemi
Microprocessor System Design Programmable Interrupt Controller.
 The Programmable Interrupt Controller (PlC) functions as an overall manager in an Interrupt-Driven system. It accepts requests from the peripheral equipment,
Intel 8259A PIC EEE 365 [FALL 2014] LECTURE 21 ATANU K SAHA BRAC UNIVERSITY.
DEPARTMENT OF ELECTRONICS ENGINEERING
Intel MP Organization. Registers - storage locations found inside the processor for temporary storage of data 1- Data Registers (16-bit) AX, BX, CX, DX.
DAC Interfacing V ref CPU D Q DAC D Q V out Clock Address bus Address
Instruction set Architecture
COURSE OUTCOMES OF MICROPROCESSOR AND PROGRAMMING
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: Internal fault (e.g.. divide by.
8254 – SOFTWARE PROGRAMMABLE TIMER
Homework Reading Labs S&S Extracts ,
Interrupts – (Chapter 12)
Instruksi Set Prosesor 8088
8259-programmable interrupt controller
Assembly Language Programming Part 2
8259A PRIORITY INTERRUPT CONTROLLER
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.
8253 Timer In software programming of 8085, it has been shown that a delay subroutine can be programmed to introduce a predefined time delay. The delay.
اصول اساسی برنامه نویسی به زبان اسمبلی
Interrupt Driven I/O References Text: Tanenbaum ch.1.4.3, ch Receiver Interrupt Program Example:
Lecture 1 Instruction set of 8086 Лектор: Люличева И.А. 1.
8259 PROGRAMMABLE INTERRUPT CONTROLLER
Microprocessor Lab CSL1543 0:0:2
UNIT-V Interrupt structure of Vector interrupt table.
Microprocessor Lab CSL1543 0:0:2
8259 Programmable Interrupt Controller
8259 PROGRAMMABLE INTERRUPT CONTROLLER
Interrupts Barry B. Brey
CS-401 Computer Architecture & Assembly Language Programming
UNIT-II Assembly Language Programs Involving Logical
Programmable Interrupt Controller (PIC)
Process.
CNET 315 Microprocessor & Assembly Language
CS-401 Computer Architecture and Assembly Language Programming
8086 microprocessior PIN OUT DIAGRAM OF  Power supply and frequency signals  It uses 5V DC supply at V CC pin 40, and uses ground at V SS pin.
Presentation transcript:

PIC &PPI PPI Mode 2 with PIC(8259)

OCW1

OCW2

OCW3

INTA waveform

Address Decoding for the Peripherals Buffer D0-D7 8255A PPI 8086 A0 A1 A2 A3 A4 A5 A6 A7 Latch (‘373) Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 ACK_A STB_A AD0-AD7 X0 X1 X2 CS Decoder 8259 ALE A0 IR0 IR1 PPI Address: 011XXPP0 8259 Address: 101XXXP0 CS

Port Addresses PORTA EQU 01100000b PORTB EQU 01100010b PORTC EQU 01100100b PPICOM EQU 01100110b P8259_0 EQU 10100000b P8259_1 EQU 10100010b PPI Address: 011XXPP0 8259 Address: 101XXXP0

PIC Initializing Sequences

ICW1 MOV AL , 00010011b ;Edge – Single – ICW4 OUT P8259_0 , AL

ICW2 MOV AL , 80H ; Interrupt Type OUT P8259_1 , AL Addresses would be: 80H to 87H

ICW3 Master Mode Slave Mode Is not needed in Single Mode

ICW4 MOV AL , 00000001b ; 8086 CPU OUT P8259_1 , AL

OCW1 MOV AL , 11111100b ; Mask IR2 to IR7 OUT P8259_1 , AL

Initialize 8259 INIT_8259: MOV AL , 00010011b ;Edge – Single – ICW4 OUT P8259_0 , AL MOV AL , 80H ; Interrupt Type OUT P8259_1 , AL MOV AL , 00000001b ; 8086 CPU MOV AL , 11111100b ; Mask IR2 to IR7 RET

Initializing PPI INIT_PPI: MOV AL , 40H ;01XXXXXX Selecting Mode 2 OUT PPICOM , AL MOV AL,1 MOV [TX_FLAG] , AL ; Flag Indicating Empty Buffer XOR AL , AL MOV [RX_FLAG] , AL ; Flag Indicating Empty Buffer MOV [TX_head],AL MOV [RX_head],AL MOV [TX_tail],AL MOV [RX_tail],AL RET

OCW2 MOV AL,01100000b ;OCW2 (EOI for IR0) OUT P8259_0,AL

Transmit Interrupt INT_TX: PUSH AX PUSH BX CALL TX_AVAIL_SIZE JNZ CONT_TX MOV AL,1 MOV [TX_FLAG],AL JMP STOP_TX CONT_TX: MOV BX,TX_BUF MOV BL,[TX_tail] MOV AL,[BX] OUT PORTA,AL INC BL MOV [TX_tail],BL STOP_TX: MOV AL,01100000b ;OCW2 (EOI for IR0) OUT P8259_0,AL POP BX POP AX IRET

Receive Interrupt INT_RX: PUSH AX PUSH BX CALL RX_EMPTY_SIZE JNZ CONT_RX MOV AL,1 MOV [RX_FLAG] JMP STOP_RX CONT-RX: IN AL,PORTA MOV BX,RX_BUF MOV BL,[RX_head] MOV [BX],AL INC BL MOV [RX_head],BL STOP_RX: MOV AL,01100001b ;OCW2 (EOI for IR1) OUT P8259_0,AL POP BX POP AX IRET

Set Interrupt Vectors MOV AX,CS MOV BX,INT_TX MOV [4*80H],BX MOV [4*80H+2],AX MOV BX,INT_RX MOV [4*81H],BX MOV [4*81H+2],AX INT_TX:LOW 200H INT_TX:HIGH 201H CS:LOW 202H CS:HIGH 203H INT_RX:LOW 204H INT_RX:HIGH 205H CS:LOW 206H CS:HIGH 207H

Transmit Function Transmit: ;Addr in SI, Size in CX CALL TX_EMPTY_SIZE JNZ CONT_Transmit CALL Check_PPI_TX CONT_Transmit: MOV AL,[SI] CALL PUTCHAR INC SI LOOP Transmit RET

Checking PPI for Transmit Check_PPI_TX: MOV AL,[TX_FLAG] ;Check if PPI Empty for TX AND AL,AL RETZ MOV AL,[TX_FLAG] ;Check again. CALL TX_AVAIL_SIZE MOV BX,TX_BUF MOV BL,[TX_tail] MOV AL,[BX] OUT PORTA,AL INC BL MOV [TX_tail],BL XOR AL,AL MOV [TX_FLAG],AL RET

Receive Data GETCH: ;Wait Until a char is received CALL RX_AVAIL_SIZE JNZ GETCHAR CALL Check_PPI_RX JMP GETCH

Checking input Buffer Check_PPI_RX: MOV AL,[RX_FLAG] ;Check if PPI Empty for TX AND AL,AL RETZ MOV AL,[RX_FLAG] ;Check again. CALL RX_EMPTY_SIZE IN AL,PORTA MOV BX,RX_BUF MOV BL,[RX_head] MOV [BX],AL INC BL MOV [RX_head],BL XOR AL,AL MOV [RX_FLAG],AL RET

Data Storage Policy Transmit TX_Service TX_FIFO Process PPI RX_FIFO RX_Service Receive

Initializing PPI INIT_PPI: MOV AL , 40H ;01XXXXXX Selecting Mode 2 OUT PPICOM , AL MOV AL,1 MOV [TX_FLAG] , AL ; Flag Indicating Empty Buffer XOR AL , AL MOV [RX_FLAG] , AL ; Flag Indicating Empty Buffer MOV [TX_head],AL MOV [RX_head],AL MOV [TX_tail],AL MOV [RX_tail],AL RET

Checking FIFO TX_AVAIL_SIZE: MOV AL,[TX_head] MOV BL,[TX_tail] SUB AL,BL RET TX_EMPTY_SIZE: NOT AL RX_AVAIL_SIZE: MOV AL,[RX_head] MOV BL,[RX_tail] SUB AL,BL RET RX_EMPTY_SIZE: NOT AL