Past exam question: Assignment 3, Q4(b)
Open in the Padhaiko app8255 PPI is mapped at base address of 7F00H using memory mapped I/O is used to control operation of lathe. The microcomputer reads instruction code from tape reader on handshake basis and sends appropriate control words to lathe. b) How do you initialize 8255A in correct mode for this application? Write down necessary control word to initialize mode as well as enable interrupt.
Solution
Selecting the Operating Mode and Port Directions:
- The tape reader sends instruction bytes to the microcomputer on a handshake basis Port A is configured as Input in Mode 1 (Strobed Input).
- The microcomputer sends control words to the lathe Port B is configured as Output in Mode 1 (Strobed Output) for synchronized handshaking with the lathe (or Mode 0 if no lathe handshake is used; Mode 1 on both ports supports full interrupt-driven handshaking).
- Port C pins automatically serve as handshake/interrupt signals:
- Group A: , , (with unused/output).
- Group B: , , .
Mode Initialization Control Word (B4H):
BSR Control Words to Enable Interrupts ( and ): In Mode 1, internal interrupt enable flip-flops are controlled via BSR mode ():
- Enable Port A Input Interrupt (): Controlled by setting (bit 4 =
100):
- Enable Port B Output Interrupt (): Controlled by setting (bit 2 =
010):
8085 initialization instructions (writing to CWR at 7F03H using memory-mapped STA):
MVI A, B4H ; Port A = Mode 1 Input, Port B = Mode 1 Output
STA 7F03H ; Write mode control word to CWR
MVI A, 09H ; BSR word: Set PC4 to enable INTE_A
STA 7F03H ; Enable Port A interrupt
MVI A, 05H ; BSR word: Set PC2 to enable INTE_B
STA 7F03H ; Enable Port B interruptInitialize 8255A in Mode 1 with Port A as strobed input (tape reader) and Port B as strobed output (lathe):
- Mode Control Word:
B4H() written to7F03H. - Interrupt Enable (BSR) Control Words:
09Hto set () and05Hto set (), both written to7F03H.