B&B Electronics PPIO manual PC Parallel Port Description

Page 5

PC PARALLEL PORT DESCRIPTION

To understand how the PPIO can be controlled you must first understand how the parallel port works inside the computer. The parallel port is designed to connect the computer with the outside world. It can have up to 12 TTL compatible outputs and up to 9 TTL compatible inputs. It cannot have both at the same time since some inputs and outputs share pins. Eight of the outputs and five of the inputs are dedicated. Four of the lines can be either inputs or outputs.

The main use for the parallel port is to send data to a printer. The port uses the eight dedicated outputs for data and the other lines for handshakes. Under normal printer operation, the computer will put an eight-bit byte on the eight lines (pins 2-9) and then use the Strobe output (pin 1) to tell the printer to read the data. Upon receipt of an Acknowledge (pin 10) from the printer the computer knows that the eight bit word was received. It can then send the next word. Other lines are used for busy, off line, etc.

All the control of the parallel port is done through software. If you look at the hardware you find that the parallel port is connected directly to the computer bus. This means that we can address these inputs and outputs in any way we want if we do not use the port to drive a printer.

Each PC has port addresses where the parallel ports, serial ports, hard disk, etc. can be addressed. These are located in the address range from 0000H to 03FFH (the H indicates the use of the hexadecimal numbering system). Each parallel port has one main port address for outputting data. The next two addresses above that address are used for handshaking control. For instance, on a typical computer a parallel port could be located at address 0378H. The handshaking lines will then be located at 0379H and 037AH. Table 1 shows the correspondence between the bits of the port and the pins of the DB-25 female connector.

Referring to Table 1, if you output a 01H (which is 00000001 in binary) to your computer’s port 0378H, then pin 2 of the parallel port’s DB-25 connector will be HIGH and pins 3 through 9 will be LOW. To do this using GWBASIC you would use the command: OUT &H378,&H01. Using this method you can output any pattern you wish on pins 2 through 9 of the parallel port. To turn ON pins 2, 4, 6, and 8 use: OUT &H378,&H55. 55H is the same as 01010101 binary. This port (0378H) can be read as an input, but mostly it is

PPIO2899 Manual

3

B&B Electronics Mfg Co Inc – 707 Dayton Rd - PO Box 1040 - Ottawa IL 61350 - Ph 815-433-5100 - Fax 815-433-5104

Image 5
Contents Not Recommended for New Installations Table of Contents Introduction Packing List PC Parallel Port Description Page BIT PPIO2899 Manual Ppio Description & Connection PPIO2899 Manual Controlling the Ppio Using Gwbasic Bit Force I/O on Force I/O OFF Low High Page Begin Controlling the Ppio Using PascalElse Mask Value Function OutputBit BitNumberBYTE Byte Procedure SetOutputBit BitNumber,OutputBYTE XOR Controlling the Ppio Using C Void SetIRQOffvoid Outport ControlAddress Mask Value Page Page New PPIO2899 Manual Page Interfacing to the Ppio PPIO2899 Manual Example USE of the Ppio Page REM IB is the Input Byte and OB is the Output Byte Appendix Hexadecimal NumbersBinary Numbers