PC/AT PARALLEL INTERFACE SECRET 1-3



        *********************************************

        *    PARALLEL INTERFACE  FOR PRINTER OR NOT *

        *********************************************









1. HOW TO FIND PARALLEL ADDRESS FIELD





1.1. BIOS DATA FIELD   - PARALLEL INTERFACES





000408H to 00040FH = input-output addresses (2 bytes) for parallel

interfaces LPT1, LPT2, LPT3, LPT4 respectively.

  - 000408H = No.0 logical channel input-output address = LPT1

  - 00040AH = No.1 logical channel input-output address = LPT2

  - 00040CH = No.2 logical channel input-output address = LPT3

  - 00040EH = No.3 logical channel input-output address = LPT4

Attention!: the channel number (LPTx) is assigned by the BIOS in the order

of channels actually present at addresses 03BCH, 0378H, 0278H. For example,

if there is only one interface at address 0278H, it is assigned to LPT1.



000478H to 00047BH = Time-out (1 byte) for printers No.0, No.1, No.2 and

No.3,  respectively.









1.2. USE DEBUG PROGRAM

*********** HOW TO FIND PARALLEL ADRESS FIELD :  *****************

                 debug <RETURN>

                 d 0:408 <RETURN>

                 The screen is :



C:\> debug               command

-d 0:408                 commande

0000:0400                         -78 03 00 00 00 00 00 00

0000:0410  33 02 C1 80 02 00 41 80-00 00 26 00 26 00 34 05

0000:0420  30 0B 30 0B 0D 1C 73 1F-0D 1C 64 20 65 12 62 30

0000:0430  75 16 67 22 0D 1C 64 20-20 39 30 0B 3A 34 01 00

0000:0440  8C 00 4B 01 07 35 00 B1-20 07 50 00 00 40 00 00

0000:0450  00 08 00 00 00 00 00 00-00 00 00 00 00 00 00 00

0000:0460  0C 0B 00 B4 03 29 00 03-00 00 E0 FF 17 40 16 00

0000:0470  00 00 00 00 00 02 B1 00-14 14 14 14 01 01 01 01

-q                       command to quit

C:\>



The 8 first byte are start address field of parallel ports :

                                  -78 03 00 00 00 00 00 00  (0378 Hexa)

                                    LPT1  LPT2  LPT3  LPT4

                       only one parallel port use in this example

**********************************************************











2. General



The parallel interface consists of a circuit specially designed for this

purpose; it includes:

  - 1 data register,

  - 1 command register,

  - 1 control port.



It occupies three addresses. The address field is determined by straps or

switchs (address decoder).

|-----------------------------|----------------------------------|

|         I/O address         |       PARALLEL INTERFACE         |

|                             -----------------------|------------

|             or         or   |      Description     |Access mode|

------------------------------------------------------------------

|  0378H  |  03BCH  |  0278H  |8-bit data register   |    Write  |

|  0379H  |  03BDH  |  0279H  |5-bit control port    |    Read   |

|  037AH  |  03BEH  |  027AH  |5-bit command register|    Write  |

|---------|---------|---------|----------------------|-----------|



The signals exchanged with the printer are sequenced by the registers and

control port; no controller is used: the time-out required to match the

different transmission speeds is done by software (time-out parameter). In

effect, except for certain applications, the software does not use the

parallel interface in interrupt mode.



You can use parallel port as an external PC/AT input or output, reading or

writing registers bits. You can command many external systems, not

especially a printer.









3. Description of the registers



Data register: 0378H (Read/Write)

Writing to this address causes the data to be stored at printer data port.

Reading from this address causes the transfer of printer port data to the

CPU data bus.













Titel       : PC/AT PARALLEL INTERFACE SECRET 2-3





Command register: 037AH (Write)

|---------------------------------------------------------------------|

|                 PARALLEL INTERFACE COMMAND REGISTER                 |

--------|-------|-------|--------|---------|--------|--------|---------

|   b7  |   b6  |   b5  |   b4   |   b3    |   b2   |   b1   |   b0   |

-----------------------------------------------------------------------

|   x   |   x   |   x   | IRQEN  |SELECTIN*| INIT*  | AUTOFD*| STROBE*|

|-------|-------|-------|---|----|---------|--------|--------|--------|

                            |    |-----------------|-----------------|

                            |               Command signals

                            |               sent to

                            |               parallel interface

                            |

                       IRQEN : (IRQ Enable)

                              _1 = interrupt valid

                              _0 = interrupt masked

                              generated on the rising edge of the

                              ACK* signal)







Control port: 0379H (Read)

|-----------------------------------------------------------------------|

|                   PARALLEL INTERFACE CONTROL PORT                     |

---------|--------|--------|--------|--------|--------|--------|---------

|   b7   |   b6   |   b5   |   b4   |   b3   |   b2   |   b1   |   b0   |

-------------------------------------------------------------------------

|  BUSY  |  ACK*  |   PE   | SELECT |ERROR*  |    x   |    x   |    x   |

|--------|--------|--------|--------|--------|--------|--------|--------|

|----------------------|---------------------|

               Parallel interface status

               signals are read;

               these bits are not stored



A rising edge of the ACK signal generates an interrupt request, if this

interrupt request is not masked (IRQEN* command register bit).













4. Electrical interface



The levels of all the signals are TTL compatible.



                             HE5 type connector 25-pin female

|------------------------------------------------|  |-----------|

|  PRINTER INTERFACE PINS        Connector       |  |     O     |

-------|-------|--------||------|-------|---------  | |-------\ |

| Pin  |Signal |I/O mode|| Pin  |Signal |I/O mode| 1| |o     o| |14

-------------------------------------------------- 2| |o     o| |15

|   1  |STROBE*|  O     ||  14  |AUTOFD*|   O    | 3| |o     o| |16

|   2  | DATA0 |  O     ||  15  |ERROR* |   I    | 4| |o     o| |17

|   3  | DATA1 |  O     ||  16  | INIT* |   O    | 5| |o     o| |18

|   4  | DATA2 |  O     ||  17  |SLCTIN*|   O    | 6| |o     o| |19

|   5  | DATA3 |  O     ||  18  |  GND  |        | 7| |o      | |

|   6  | DATA4 |  O     ||  19  |  GND  |        | 8| |o     o| |20

|   7  | DATA5 |  O     ||  20  |  GND  |        | 9| |o     o| |21

|   8  | DATA6 |  O     ||  21  |  GND  |        |10| |o     o| |22

|   9  | DATA7 |  O     ||  22  |  GND  |        |11| |o     o| |23

|  10  |  ACK* |  I     ||  23  |  GND  |        |12| |o     o| |24

|  11  |  BUSY |  I     ||  24  |  GND  |        |13| |o     o| |25

|  12  |  PE   |  I     ||  25  |  GND  |        |  | |-------/ |

|  13  |  SLCT |  I     -|------|-------|--------|  |     O     |

|------|-------|--------|                           |-----------|

                          - Connector  pin arrangement



ACK*: When active, (pulse of several micro.s) this signal indicates that

  the data has been handled by the printer.



AUTOFD*: (automatic feed) when low, this signal control the paper feed

  motor. Writing a 1 in the interface control AUTOFD* bit causes an

  automatic line feed after each carriage return. This bit must be reset

  if the printer controls the automatic line feed or if the file to be

  printed already has a line feed stored after each carriage return.



BUSY: When active (high), this signal indicates that the printer is busy

  and that data cannot be handled.



DATA0 to DATA7: Data lines. Data is transmitted in 8-bits format (extended

  ASCII code).



ERROR*: Active low, this signal indicates that the printer is in standby

  subsequent to error detection (such as paper end).



INIT*: Active low, this signal initializes the printer's electronics.



PE: (Paper End) when high, this signal indicates that a sensor has detected

  a paper end condition.



SLCTIN*: When low, this signal enables printer operation.



SLCT: When high, this signal indicates that the printer is ready to receive

  data (response to SELECTIN)



STROBE*: Active low, this signal samples the data present on the data

  lines.















Titel       : PC/AT PARALLEL INTERFACE SECRET 3-3







5. Parallel printer connection



COMPUTER                                                 PRINTER

(connector HE5, 25-pin)                          (Centronics type

                                                  36-pin connector)



STROBE*          1 -----------------------------> 1       STROBE*

D0 to D7    2 to 9 -----------------------------> 2 to 9  D0 to D7

ACK*            10 <----------------------------- 10      ACK*

BUSY            11 <----------------------------- 11      BUSY

PE              12 <----------------------------- 12      PE

SELECT          13 <----------------------------- 13      SELECT

AUTO FEED       14 -----------------------------> 14      AUTO FEED

ERROR           15 <----------------------------- 32      ERROR

INIT            16 -----------------------------> 31      INIT

SELECT IN       17 -----------------------------> 36      SELECT IN

ground    18 to 25 ------------------------------ 19 to 30 ground



               -------------

               |     O     |

               | --------- |

               | --------- |

     STROBE*  1| ||     || |19 ground

       DATA0  2| ||     || |20 ground

       DATA1  3| ||     || |21 ground

       DATA2  4| ||     || |22 ground

       DATA3  5| ||     || |23 ground

       DATA4  6| ||     || |24 ground

       DATA5  7| ||     || |25 ground

       DATA6  8| ||     || |26 ground

       DATA7  9| ||     || |27 ground

        ACK* 10| ||     || |28 ground

        BUSY 11| ||     || |29 ground

          PE 12| ||     || |30 ground

        SLCT 13| ||     || |31 INIT*

  AUTO FEED* 14| ||     || |32 ERROR*

             15| ||     || |33 ground

      ground 16| ||     || |34

     chassis 17| ||     || |35

         +5V 18| ||     || |36 SLCTIN*

               | --------- |

               | --------- |

               |     O     |

               -------------



 - Centronics type 36-pin connector pin arrangement











6. Printer control procedure



The Centronics interface is a parallel interface between the microcomputer

and a printer.

The characters are sent to the printer in ASCII code..

Synchronization and dialogue are provided by three signals: STROBE*, ACK*

and BUSY.





CONTROL PROCEDURE

          ------------                ------------

DATA    --            ----------------            ----------------

          <T1><T2>                    <T1><T2>



        ------    ------------------------    --------------------

STROBE*       ----<T3>                    ----<T3>



                 ---------------                  ------------

BUSY    -----------------       ------------------            ----



        ------------------------  ----------------------------  --

ACK*                            --                            --

                               >--<2,5 a 30 mic.s



                                   -----                         --

IRQ     ---------------------------     -------------------------











SENDING A CHARACTER TO THE PRINTER: When the BUSY line is at 1, the printer

accepts a character. The ASCII code of the character is presented in

parallel on the printer's data bus.

After time-out T1 (Set Up Time = 1micro.s at least), the system switchs the

STROBE* signal to 0. On the falling edge of this signal, the character code

is handled by the printer. The data bus must keep the character code for at

least T2+T3 (Strobe + Hold Time).





PRINTER RESPONSE: The printer responds by switching the BUSY line to 1 to

signal that it will not accept another character. This signal indicates the

printer's status.

By sending an ACK* signal (5 micro.s to 30 micro.s pulse), it signals that

the data has been handled and more data can be accepted.







END



********************************

*         73 QRO               *

*   F6FLV@FF6KRK.FRPA.FRA.EU   *

*        Jean-Pierre           *

*      BOIS D'ARCY (78)        *

*          JN18AT              *

********************************

 