How can I use the parallel port of PC with C++ ?

Status
Not open for further replies.

farzam

Junior Member level 2
Joined
Jan 14, 2007
Messages
21
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,407
hi
how can i use parallel port of PC by C++
i want to write a very simple program that make one pin of parallel port 0 and 1
 

PC's parallel port

go through this forum
**broken link removed**

You will get some idea. download 'my experience in parallel port interfacing' from files section of yahoo group-booksbybibin

Bibin John
www.bibinjohn.tk
 

Re: PC's parallel port

If you want to control printer port or 8255 card such as Pin 2-9 of printer port with C++ programming go to like below

http://thaiio.com/prog-cgi/programing.cgi?0035

That has both method ,source code and diagram for interface PC's ports
 

    farzam

    Points: 2
    Helpful Answer Positive Rating
Re: PC's parallel port

Hi

In C++ you can write/read data in/from ports (including serial an parallel ports) using the _outp /_inp commands respectively.
The PC parallel port has two input ports and one output port :

DATA PORT ,output; in the address of 0x378
STATUS PORT ,input; in the address of 0x379
CONTROL PORT ,output; in the address of 0x37a


The syntax for the _outp command is as follows :

Code:
int _outp(unsigned short PORT_ADDRESS , int data)

instead of using the hex addresses ,you can define constant names for each port :

Code:
const int  DATA_PORT=0x378;
const int  STATUS_PORT=0x379;
const int  CONTROL_PORT=0x37a;

here is an example of how to write/read data in/from ports :

Code:
_outp(DATA_PORT,data); 
_outp(CONTROL_PORT,data);
readData=_inp(STATUS_PORT)


regards
 

PC's parallel port

inp and outp haven't worked since Win98. You have
to use IO .dlls that allow access to ports in Win2K and XP by messing with the IO privilege map (or whatever it's called) and using a couple of undocumented low level routines in the WinAPI ). In fact I think the last one I used was called IO.DLL. Anyway, there are several out there.
 

PC's parallel port

For more info about I/O drivers, visit Parallel Port Central:
**broken link removed**
 

PC's parallel port

download Parrallel port book in E-books Section It Is Good one for understanding
 

Re: PC's parallel port

Hi guys,

Is there any source for USB port similar to these serial and parallel ports, interfacing in C++???

thanks,
cedance.
 

PC's parallel port

yes in windows there is a software named "Virtual com port" that comes with some 'usb modules'
you can treat with usb port just like a com port
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…