Given that port A, port B, port C and the control register have addresses FFF8, FFF9, FFFA and FFFB, respectively, the sequence:

                 MOV   DX,0FFFBH
                 MOV   AL,10110000B
                 OUT   DX,AL

would cause port A to be put in mode 1, port B to be put in mode 0, and PC7 to be an output.
          
  The sequence:
                 MOV   DX,0FFFBH
                 MOV   AL,00001111B
                 OUT   DX,AL       
                 MOV   AL,00001110B
                 OUT   DX,AL      
would output a pulse to the convert pin of the A/D converter.The first instruction of the latter sequence puts the address associated with Set/Reset instruction, which is the same as the address of the control register, in the DX register.The next two instructions cause PC7 to be set and the last two cause it to be cleared.
A sequence for providing a programmed I/O input of the converted data is:
                  MOV   DX,0FFFAH
          AGAIN:  IN    AL,DX
                  TEST  AL,00100000B
                  JZ    AGAIN
                  MOV   DX,0FFF8H
                  IN    AL,DX   

For outputting a byte from AL to the D/A converter, only the instructions

                  MOV   DX,0FFF9H
                  OUT   DX,AL
are needed.As soon as the byte arrives at port B its bits are immediately applied to the input pins of the D/A converter, which, in turn, immediately converts it to an analog signal.
The sample time could be adjusted by including a "do nothing" loop, such as:
                   MOV   CX,N   
            IDLE:  NOP
                   LOOP  IDLE

between the inputs or outputs.

PRETHODNA FOLIJA SADRZAJ SLEDECA FOLIJA