Professional Documents
Culture Documents
Usually ports are found on the rear of computer and are of the following two types;
1)
Male ports
having pins coming out of port.
2)
Female ports
having holes for pins.
Parallel port is generally a 25 pin female connector with which a printer is usually attached.
Data port:
It includes pin 2 to pin 9 with pin names Data-0 to Data- 9
It is usually for data output according to old standard parallel port standard.
Status Port
Status port is an input only port i.e. Data cant be output on this port but it can only be read.
Control port
Control port is a read / writes port. For printer purposes it is write only port.
How to access parallel port pins in the software.
Parallel port is assigned a unique I/O address which is generally among the following:
i) 378h
(mostly used in output)
ii) 278h
(normally found when there are more than one parallel ports)
iii)379h
(for the input)
Prepared By: Engr. Policarpio Tena II, MEng
1/9
2/9
3/9
SAMPLE APPLICATION
1.) Demonstration of control of light Bulb through parallel port
4/9
Picture-3
Now you can see a dialog box with caption Win32 Console Application - step 1 of 1 (picture-4).
Picture-4
Prepared By: Engr. Policarpio Tena II, MEng
5/9
Select a simple Application and click Finish. Now open example1.cpp from fileview and replace the existing code with the code given
below.
#include "stdafx.h"
#include "conio.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
int main(int argc, char* argv[])
{
short data;
if(argc<2)
{
printf("Usage\n\n");
printf("partest1.exe ,,\n\n\n");
return 0;
}
if(!strcmp(argv[1],"read"))
{
data = _inp(atoi(argv[2]));
printf("Data read from parallel port is ");
printf("%d\n\n\n\n",data);
}
if(!strcmp(argv[1],"write"))
{
_outp(atoi(argv[2]),atoi(argv[3]));
printf("Data written to parallel port is ");
printf("%s\n\n\n\n\n",argv[3]);
}
return 0;
}
6/9
IN PORT (Status)
Range of voltage for logic high and logic low
But it will give you incorrect results. The reason is the range of voltage levels that are considered high or low.
Parallel port is TTL(transistor transistor logic) compatible in which
Logic high is a voltage between 0 to 0.8 V
Logic low is a voltage between 2.0 to 5V
Any voltage in between the above rage is undefined.
A voltage higher than the logic high or lower than the logic low can damage your port or any other TTL circuit.
You should connect an external resistor with pin to get logic high voltage which depends upon the supply voltage you
use.
7/9
8/9
These days starting from PCs equipped with Pentium processors, the parallel ports have Bi-directional read/write
facility.
Bi-directional means that you can read byte (8 bits) from parallel port which traditionally was an output only port in the
old PCs.
In order to check whether your port is configured for it, restart your PC and go into BIOS see the portion related to the
parts. You will find port address as well as its type, usually the options are as follows
All above signaling was done by software in which PC had to wait for a response from printer before outputting the next signal. It was a
slow process with data rate of 50KB/sec to 150KB/sec.
EPP Handshake
EPP was designed to do, the above described, handshaking by a separate hardware chip instead of main processor. It is described as
follows:
EPP Data Write Cycle
9/9
10/9