Group A is associated with one of three modes, mode 0, mode 1 and mode 2, and group B with one of two modes, mode 0 and mode 1.The modes are determined by the contents of the control register whose format is given in Fig.9-22.These modes are:
Mode 0 - If a group is in mode 0, it is divided into two sets.For group A these sets are port A and the upper 4 bits of port C,and for group B they are port B and the lower 4 bits of port C.Each set may be used for inputting or outputting, but not both.Bits D4,D3,D1 and D0 in the control register specify which sets are for input and which are for output.These bits are associated with the sets as follows:

                             D4 - Port A                           
                             D3 - Upper half of port C
                             D1 - Port B
                             D0 - Lower half of port C
If a bit is 0,then the corresponding set is used for output;if it is 1, the set is for input.

Mode 1 - When group A is in this mode port A is used for input or output according to bit D4 (D4=1 indicates input), and the upper half of port C is used for handshaking and control signals.For inputting, the four MSBs of port C are assigned the following symbols and definitions:
            ___
   PC4      STBa      A 0 applied to this pin causes PA7-PA0 to be latched,
                      or "strobed", into port A.
   PC5      IBFa      Indicates that the input buffer is full.It is 1 when
                      port A contains data that have not yet been input to
                      the CPU.When a 0 is on this pin the device can input
                      a new byte to the interface.
   PC6,PC7            May be used to output control signals to the device
                      or input status from the device.If D3 of the control
                      register is 0, they are for outputting control signals;
                      otherwise, they are for inputting status.
 For outputting:  
   PC4,PC5            Serve the same purpose as described above
             ___      for PC6,PC7.
   PC7       OBFa     Indicates that the output buffer is full.It outputs
                      a 0 to the device when port A is outputting new data
             ___      to be taken by the device.
   PC6       ACKa     Device puts a 0 on this pin when it accepts data 
                      from port A.
In mode 1, PC3 is denoted INTRa and is associated with group A.It is used as an interrupt request line and is tied to one of the IR lines in the system bus.When inputting to port A, this pin becomes 1 when new data are put in port A (i.e., it is controlled by PC4) and is cleared when the CPU takes the data.For output, this pin is set to 1 when the contents of port A are taken by the device and is cleared when new data are sent from the CPU. If group B is in mode 1, port B is input to or output from according to bit D1 of the control register (D1=1 indicates input).For input, PC2 and PC1 are denoted \STBb and IBFb, respectively, and serve the same purposes for group B as \STBa and IBFa do for group A.Similarly, for output PC1 and PC2 are denoted \OBFb and \ACKb.PC0 becomes INTRb and its use is analogous to that of INTRa.The interrupt enable for group A is controlled by setting or clearing internal flags.Setting or clearing these flags is simulated by setting or clearing PC4 for input, or PC6 for output, using a Set/Reset instruction.Similarly, the interrupt enable for group B is controlled by set/clear of PC2 for both input and output.
Mode 2 - This mode applies only to group A, although it also uses PC3 for making interrupt requests.In mode 2, port A is a bidirectional port and the four MSBs of port C are defined as follows:
            ___
   PC4      STBa      A 0 on this line causes the data on PA7-PA0 to be
                       "strobed" into port A.
   PC5      IBFa      Becomes 1 when port A is filled with new data from 
                      lines PA7-PA0 and is cleared when these data are
             ___      taken by the CPU.
   PC6       ACKa     Indicates that the device is ready to accept data 
             ___      from PA7-PA0.
   PC7       OBFa     Becomes 0 when port A is filled with new data from 
                      the CPU and is set to 1 when data are taken by the
                      device.
While group A is in mode 2, group B may be in either mode 0 or mode 1. However, if group B is in mode 0, only PC2-PC0 can be used for input or output because group A has borrowed PC3 to use as an interrupt request line.Normally, if group A is in mode 2, PC2-PC0 would be connected to control and status pins on the device attached to the port A lines.Port B may also be used for this purpose.

PRETHODNA FOLIJA SADRZAJ SLEDECA FOLIJA