Documente Academic
Documente Profesional
Documente Cultură
A device used to implement data transfer between processor and peripherals like ADC, DAC, keyboard, 7 segment display Has three 8 bit ports- Port A, Port B, Port C Has three operating modes Mode 0 - Simple I/O Mode 1 Handshake I/O Mode 2-Bidirectional I/O
8255 PPI
8255 PPI
A - can be programmed as input or output port. It can also be an 8-bit bidirectional port. B - also can be programmed as in input or output port. It cannot be used as an 8-bit bidirectional port. C - can also be either an input or an output port. Can be split into two 4 bit ports. Each 4 bit port can be either an input or an output port. Also, bits of C port can be set/reset individually through program.
Has two control words I/O Mode Set Control Word(MSW) Bit Set Reset Mode (BSR)
Mode 2 of 8255
DMA Transfer
Has a number of channels and each channel can may service an I/O independently Each channel has a address register, control register and count register. DMA controller works as master or slave In slave mode the processor loads the address register with starting address, count register with no of bytes and control register with control information.
DMA Transfer
I/O needs DMA transfer First DMA request signal is sent to DMA controller DMA controller sends hold request to processor At the end of current instruction processor release the control of buses. Processor sends hold acknowledgement DMA controller takes control of system bus (starts master mode)
DMA Transfer
DMA controller sends DMA acknowledgement With this the device is ready for data transfer DMA Read Operation Controller output the memory address on address bus Asserts memory read and IO write signals Memory output the data on data bus and this is written to IO port
DMA Transfer
DMA write operation DMA controller output the memory address and asserts memory write and IO read signals IO device output data on data bus and is written to memory After data transfer the processor takes control of buses DMA can be as bytes of data or blocks of data.
DMA Transfer
Status Register
Programming 8259
Requires two types of command words Initialization Command Word(ICW) Operational Command Word(OCW) Initialized with 4 ICWs-2 are essential and other 2 are optional based on modes. The words should be issued in a sequence 8259 can be made to operate in various modes by 3 OCWs
ICW1
ICW2
Interrupt type MSB 5 bits and LSB 3 bits are 0 IR0
ICW4
OCW1
OCW1 must be sent to an 8259 to unmask any IR inputs.
OCW2
OCW2 is mainly used to reset a bit in ISR. Once ISR bit is reset 8259 can respond to interrupt signals of lower priority.
OCW2
Non Specific EOI- Terminate current interrupt being serviced by 8259. Reset the corresponding bit in ISR of 8259 and allow higher priority interrupt. Specific EOI-Terminate specific interrupt request decided by lower 3 bits of OCW2. Rotate on NEOI- rotate priority Rotate on Automatic EOI- Select AEOI with rotate priority Rotate on specific EOI-same as 2 with rotate priority.
OCW3
RD WR A0 A1
Counter 2
Mode 0
Count value is loaded in count register. If the gate is high the counter is decremented and provide a high output when the count is zero. Low to high transition of counter used as an interrupt to the processor to initiate any activity. Count N loaded in count register, output high after N+1 clock pulses
Mode 1
Works as a retriggerable monostable multivibrator. Gate acts as trigger pulse to start the count process (low to high transition). When count value is loaded into counter the output is low Output becomes high when count value is zero. Mode 1 produces a logic low pulse whose width is equal to the duration of count.
Mode 2
Used to generate a periodic low pulse of width equal to one clock period. A count value of N loaded in count register the output will go low once in N clock period. Gate should remain high. Counter is reloaded at the end and the pulses are repeated.
Mode 3
Counter generates a square wave. If a even number N is loaded in count register, output will be High for N/2 clock period and low for the next N/2 clock periods. If a odd number N is loaded in count register, output will be High for (N+1)/2 clock period and low for the next (N-1) /2 clock periods. Original count is reloaded and process repeated. Gate is high
Mode 4
Used to generate a single low pulse after a delay. A count N is loaded in the counter a low pulse of width equal to one clock period is generated in the (N+1)th clock period. Used as a strobe signal in parallel data transfer. Gate is high
Mode 5
Same as Mode 4 except that there should be a low to high transition at Gate. If gate makes a low to high transition before the end of count the original count value is reloaded in the next clock period.
SC1 SC2 0 0- Select Counter 0 01- Select Counter 1 10- Select Counter 2 1 1- illegal
RW1 RW0 M2 M1 M0 0 0- Counter latch 0 0 0 Mode 0 0 1- read/Write LSB only 0 0 1 Mode 1 1 0-Read/Write MSB only x 1 0 Mode 2 1 1- Read/Write LSB first x 1 1 Mode 3 and then MSB 1 0 0 Mode 4 1 0 1 Mode 5
Transmit Control
Tx RDY Tx E Tx C
B u s
Receive Buffer
Receive Control
RxD
Rx RDY Rx C Syndet/BD
Transmitter Section
Converts 8 bit data to serial data
Transmitter Buffer Output Reg Tx D (Transmit Data)
Tx C Tx RDY Tx E
Receiver Section
Receives serial data and sends parallel data
Receiver Buffer register Input Reg Rx D (Receives data)
Rx C Rx RDY Syndet/BD
Initializing 8251
16 bit control register for control word 16 bit status register for checking ready status of input registers To initialize 8251 send a mode word and then a command word to the control register
Mode Word
D7
D6
D5
D4
D3
D2
D1
D0
Framing Control D7 D6 0 0-Not valid 0 1-1Stop bit 1 0-11/2 Stop bit 1 1-2 Stop bit
Parity Control
Character Length
D5 D4 D3 D2 D1 D0 x 0- No parity 0 0-5 bits 0 0-Syn Mode 0 1-Odd parity 0 1-6 bits 0 1-Asyn x1 1 1-Even Parity 1 0-7 bits 1 0-Asyn x 16 1 1-8 bits 1 1-Asyn x 64
Control Word
*-Bits for synchronous format modem control
* EH IH *RTS ER *SBRK Rx E *DTE Tx EN
Internal Reset
Error Reset 1-Enable 1-reset 1-Enable 0-Disable error flags DTR 1-Enable PE,OE,FE 1-Enable Send Break 0-Disable character 1-forces TxD low
Status Word
DSR-indicates DSR is at low level PE-Set with parity error. Reset with error bit of command word 0E-Set when CPU does not read a character before next is available. FE-Async mode only. Set when valid stop bits is not detected.
DSR SYNDET/ BRKDET FE OE PE TxEMPTY RxRDY TxRDY