1203 Ppi 8155

9,143 views

Published on

ppi 8155 interfacing
visit: www.techbed.blogspot.com

Published in: Education, Business, Technology
2 Comments
5 Likes
Statistics
Notes
No Downloads
Views
Total views
9,143
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
653
Comments
2
Likes
5
Embeds 0
No embeds

No notes for slide
  • 00000111 07h
  • 1203 Ppi 8155

    1. 1. Programmable Peripheral Interface Devices Support chips : 8155 , 8255 , 8279, 8254 , DMA Controller, Interrupt Controller, USART
    2. 2. Programmable Interface Devices <ul><li>used to interface a I/O device to the microprocessor </li></ul>8085 Programmable I/O Interface I/O Devices System Bus
    3. 3. 8155 – A multipurpose programmable interface <ul><li>Designed to be compatible with 8085 </li></ul><ul><li>It includes </li></ul><ul><ul><li>256 bytes of Read/Write memory </li></ul></ul><ul><ul><li>Three I/O ports </li></ul></ul><ul><ul><ul><li>Port A </li></ul></ul></ul><ul><ul><ul><li>Port B </li></ul></ul></ul><ul><ul><ul><li>Port C </li></ul></ul></ul><ul><ul><li>A 14-bit timer </li></ul></ul>
    4. 4. Block Diagram - 8155 256 X 8 Static RAM A B C Timer 8 8 6 Port A Port B Port C PA 0-7 PB 0-7 PC 0-5 8 AD 0-7 IO/M CE ALE RD WR Timer CLK TIMER OUT Vcc (+5 V) Vss (0 V) RESET I/O Devices 8085
    5. 5. Application design with 8155 <ul><li>Objectives </li></ul><ul><ul><li>Interfacing 8155 with 8085 </li></ul></ul><ul><ul><li>Programming 8155 </li></ul></ul>
    6. 6. Interfacing 8085 with 8155 8085 256 X 8 Static RAM A B C Timer 8 8 6 Port A Port B Port C 8 AD 0-7 IO/M CE ALE RD WR RESET A 15 8085 8155
    7. 7. Programming 8155 <ul><li>8155 is a Programmable Peripheral Interface </li></ul><ul><li>8085 can send data to 8155 using data bus </li></ul><ul><li>This data can be </li></ul><ul><ul><li>For I/O devices connected to 8155 </li></ul></ul><ul><ul><li>Timer registers of 8155 </li></ul></ul><ul><ul><li>Instruction/ Command word for 8155 </li></ul></ul><ul><li>Commands for 8155 are stored in a 8-bit Control Register inside 8155 </li></ul>
    8. 8. What type of Commands can be given to 8155? <ul><li>To configure the I/O ports as Input or Output </li></ul><ul><li>To start/stop timer etc. </li></ul><ul><li>To use handshake mode or not </li></ul>
    9. 9. Control word for 8155 <ul><li>A command/instruction for 8155 is also called control word </li></ul><ul><li>This control word is written to control register of 8155 </li></ul><ul><li>Control word of 8155 is of 8-bits </li></ul>
    10. 10. Control Word Definition for 8155 Port A Port B 0, Input 1, Output Port C Interrupt Enable Port A Interrupt Enable Port B 0, Disable 1, Enable Timer D0 D1 D2 D3 D4 D5 D6 D7 D3 D2 PORT C 0 0 ALT1 0 1 ALT2 1 0 ALT3 1 1 ALT4 D7 D6 Timer 0 0 NOP 0 1 Stop 1 0 Stop after TC 1 0 Start
    11. 11. I/O functions of Port C I = Input O = Output STB = Strobe BF = Buffer Full INTR = Interrupt Request ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0 ALT1 0 0 I I I I I I ALT2 0 1 O O O O O O ALT3 1 0 O O O STB A BF A INTR A ALT4 1 1 STB B BF B INTR B STB A BF A INTR A
    12. 12. Design an interfacing circuit to read data from an A/D converter using the 8155A in the peripheral mapped I/O . 8085 3-to-8 Decoder A/D Converter Analog Input Digital Input Por t A AD0-AD7 O 0 O 7 8155 Por t C Por t B SOC OE EOC O 2 CE E 2 E 1 A 2 A 1 A 0 A 11 A 12 A 13 A 14 A 15 IO/M RD WR RESET ALE LED Display BF A STB A PC5
    13. 13. Port Addresses of 8155 Chip Selection A7 A6 A5 A4 A3 0 0 0 1 0 = 10H = 11H = 12H = 13H = 14H = 15H A2 A1 A0 Port 0 0 0 Control/Status Register 0 0 1 Port A 0 1 0 Port B 0 1 1 Port C 1 0 0 LSB Timer 1 0 1 MSB Timer
    14. 14. Application Programming Logic <ul><li>Configure 8155 </li></ul><ul><li>8085 sends SOC command to ADC </li></ul><ul><li>8085 communicates with ADC using PortC in handshake mode </li></ul><ul><li>8085 reads 8-bit temperature value from port A </li></ul><ul><li>8085 displays the temperature value on the LED display </li></ul>
    15. 15. 1. Configure 8155 I/O Ports <ul><li>Port A as INPUT port </li></ul><ul><li>Port B as OUTPUT port </li></ul><ul><li>Port C in ALT3 mode </li></ul>SOC EOC OE ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0 ALT3 1 0 O O O STB A BF A INTR A
    16. 16. Control Word for configuration Port A Port B 0, Input 1, Output Port C IE Port A IE Port B 0, Disable 1, Enable Timer D0 D1 D2 D3 D4 D5 D6 D7 D3 D2 PORT C 0 0 ALT1 0 1 ALT2 1 0 ALT3 1 1 ALT4 D7 D6 Timer 0 0 NOP 0 1 Stop 1 0 Stop after TC 1 0 Start 0 1 0 1 0 0 0 0
    17. 17. Program Instructions for configuration <ul><li>Data </li></ul><ul><ul><li>Control word : 0A H </li></ul></ul><ul><li>Port Address </li></ul><ul><ul><li>Address of Control register : 10 H </li></ul></ul><ul><li>Instructions </li></ul><ul><ul><li>MVI A, 0A H </li></ul></ul><ul><ul><li>OUT 10 H </li></ul></ul>
    18. 18. 2. 8085 sends SOC command to ADC <ul><li>A small duration pulse on SOC input of ADC will start conversion process </li></ul><ul><li>SOC input of ADC is connected to port pin PC5 of Port C (Port address 13 H) </li></ul><ul><li>Data </li></ul><ul><ul><li>Data value 20 H followed by 00 H </li></ul></ul>SOC ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0 ALT3 1 0 O O O STB A BF A INTR A 1 0 0 0 0 0
    19. 19. <ul><li>Instructions </li></ul><ul><ul><ul><li>Start: MVI A, 20H </li></ul></ul></ul><ul><ul><ul><li>OUT 13H </li></ul></ul></ul><ul><ul><ul><li>MVI A, 00H </li></ul></ul></ul><ul><ul><ul><li>OUT 13H </li></ul></ul></ul>
    20. 20. 3. 8085 communicates with ADC using Port C in handshake mode <ul><li>Port A used to input 8-bit data from ADC </li></ul><ul><li>Port C used for handshaking </li></ul>EOC OE ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0 ALT3 1 0 O O O STB A BF A INTR A
    21. 21. <ul><li>ADC resets EOC to LOW at end of conversion </li></ul><ul><li>8155 sets BF to 1 to enable ADC output latch </li></ul><ul><li>8085 is waiting for BF to be SET to 1 and </li></ul><ul><ul><li>Reads port A by making RD signal active ( 0 ) </li></ul></ul><ul><li>At the end of read cycle RD goes HIGH ( 1 ) </li></ul><ul><li>This resets BF signal to 0 . </li></ul><ul><li>8085 waits for BF signal to be RESET and </li></ul><ul><ul><li>starts conversion process again </li></ul></ul>
    22. 22. 8085 is waiting for BF <ul><li>To know the status of BF signal 8085 reads status register of 8155 </li></ul><ul><li>Status register shares same address as control register </li></ul>Status Word Definition X Timer INTEB BFB INTRB INTEA BFA INTRA D7 D6 D5 D4 D3 D2 D1 D0
    23. 23. Program Instructions <ul><li>8085 reads status register </li></ul><ul><ul><li>Address of status register : 10H </li></ul></ul><ul><ul><li>Reads port A if BFA = 1 </li></ul></ul><ul><ul><li>Output temperature on port B </li></ul></ul><ul><li>Status: IN 10H </li></ul><ul><li> ANI 02H </li></ul><ul><li> JZ Status </li></ul><ul><li> IN 11H ; Step -4 Reads temperature value </li></ul><ul><li> OUT 12H ; Step –5 display on LED’s </li></ul>
    24. 24. <ul><li>8085 reads status register </li></ul><ul><ul><li>Address of status register : 10H </li></ul></ul><ul><ul><li>Starts conversion again if BFA = 0 </li></ul></ul><ul><li>Again: IN 10H </li></ul><ul><li> ANI 02H </li></ul><ul><li> JNZ Again </li></ul><ul><li> JMP Start </li></ul>
    25. 25. Complete Program <ul><ul><li> MVI A, 0A H </li></ul></ul><ul><ul><li> OUT 10 H </li></ul></ul><ul><ul><li>Start: MVI A, 20H </li></ul></ul><ul><ul><ul><li>OUT 13H </li></ul></ul></ul><ul><ul><ul><li> MVI A, 00H </li></ul></ul></ul><ul><ul><ul><li> OUT 13H </li></ul></ul></ul><ul><li>Status: IN 10H </li></ul><ul><li> ANI 02H </li></ul><ul><li> JZ Status </li></ul><ul><li> IN 11H </li></ul><ul><li> OUT 12H </li></ul><ul><li>Again: IN 10H </li></ul><ul><li> ANI 02H </li></ul><ul><li> JNZ Again </li></ul><ul><li> JMP Start </li></ul><ul><li>Configure 8155 </li></ul><ul><li>Start Conversion </li></ul><ul><li>Read Status register </li></ul><ul><li>Wait till BF A = 1 </li></ul><ul><li>Read temperature value </li></ul><ul><li>Display on LED </li></ul><ul><li>Read status register </li></ul><ul><li>Wait till BF A = 0 </li></ul><ul><li>Start Conversion again </li></ul>

    ×