Sunday, April 23

OPERATIONAL MODES OF 8255

OPERATIONAL MODES OF 8255
8255 can be mainly configured in two modes.
                        i)  Input/Output mode (I/O mode)
                        ii)  Bit Set-Reset mode (BSR mode)
  Input/Output mode
            In I/O mode, the ports of 8255 acts as programmable ports, while in BSR mode only port C (PC0 - PC7) can be used to set or reset its individual port bits.
            The 8255 can programmed to operate in any one of the following modes.
            i) Mode 0 (simple mode)         ii)  Mode 1 (strobed mode)    
            iii) Mode 2 (bi-directional bus mode)

Mode 0: Simple I/O Mode
            This is a simple I/O or basic mode in which no hand shake signals are used.  Port A and Port B are used as two simple 8 bit I/O ports and port C as two 4 bit ports it is used with those I/O devices whose timing characteristics are clearly known.  For example, if an I/O device sends a byte for every 10 ms, to the UP, we can execute the IN instruction for every 10 ms to receive the data.
            All the 3 ports can be programmed in Mode 0.
Mode 1: Strobed Mode
            This is a handshake I/O mode (strobed mode) in which the data transfer is controlled by handshake signals.  For example, when the microprocessor wish to transfer the data to a relatively slow device like printer, for proper transfer of data handshake signals are used to inform the processor whether the printer is ready to receive the data or not.  The data transfer by handshake use both port A and port B as 8 bit input/output ports.  Port A uses the upper three signals PC3, PC4 and PC5 where as port B uses the lower signals PC2, PC1 and PC0 for handshaking signals.  The remaining two lines of port C are used in Mode 0.  The unique feature of this mode is that the data transfer can take place without direct CPU intervention.  When port A or port B are configured as input ports the three control signals used are IBF (Input Buffer Full),  (strobe) and INTR (Interrupt request).  Similarly when port A or port B are programmed as mode 1 output ports, the three control signals used are  (Output Buffer Full),  (Acknowledge) and INTR (Interrupt Request).
            A very important point to be remembered is that only port A and port B can be configured in mode 1.
 Mode 2: Bidirectional I/O (or) Strobed Bidirectional I/O
            In this mode port A alone can be configured to both, transmit and receive data.  Place over a single 8 bit data bus using handshaking signals.  This mode of operation is useful when transferring data between two computers.  As it is bidirectional I/O, it needs more number of handshake signals i.e., 5 lines of port C, PC3 - PC7.  The remaining lines of port C can be used by port B in Mode 1.  So, when port A is programmed to operate in mode 2, port B can operate in mode0 or mode1.If programmed for mode 0, PC0 - PC2 can be programmed as mode 0 inputs or outputs. If port B is programmed for mode 1, PC0 - PC2 become handshake signals for this port.
            In conclusion, we can understand that,
            Port A can be in Mode 0, Mode 1 or Mode 2.
            Port B can be in Mode 0 or Mode 1
            Port C can only be in Mode 0.
Note:  A high on reset line of 8255, resets all the ports A, B and C to work as input ports in mode 0. The reset pin of 8255 is generally connected to Reset Out pin of 8085.
 BSR (Bit Set/Reset) Mode

            The BSR mode is related to only with the 8 bits of port C, which can be set or reset by writing an appropriate control word in the control register.  A control word with bit D7 = 0 is treated as a BSR control word.  It does not change any previously transmitted control word with bit D7=1.So, the I/O operations of port A and port B are not changed by a BSR control word.  In BSR mode, individual bits of port C can be used for applications such as an ON/OFF switch.

No comments:

Post a Comment