Below is a Turbo C code for parallel port testing....
Code:
#include<stdio.h>
#include <conio.h>
#include <dos.h>
int main(void)
{
int far *LPT1=(int far*)0x408;
int portID=*LPT1;
short int inData, outData;
clrscr();
printf("LPT1 Address is at %X\n",portID);
while(!kbhit())
{
inData=inportb(portID);
printf("Read :%X\n",inData);
outData=inData^0xFF;
outportb(portID,outData);
printf("Write :%X\n",outData);
delay(1000);
}
return 0;
}
When I test this code on machines with WindowsXP, I see an output like
Code:
Read : AA
Write: 55
Read: AA
Write: 55
However, when I run this code on win98 systems,
Code:
Read : AA
Write: 55
Read: 55
Write: AA
What could be the reason? I have not tested this on any other OS. How can I get over this problem.
you are using the parrallel port with the address port of win98 because win98 give you the rights to access machine ports but you are restricted in winXP you have to use some kind of driver to access the port or you may learn the socket programming to use it in easy manner.
ok.
I have to complete an parallel port interfacing project in C. My college computers run Windows 98. However, all my friends are using XP. I myself do not have access to a PC so have to go to my friend's place for the PC. and those programmes that run perfectly well in the college, give a hell lot of torubles at home.
I cannot use anything other than TC. It is a course requirement.
As WinXP kernal has not user to direct access to port ,you may be using DLL from
"I/O Port DLL File " of www.lvr.com
Which has Ex. code and DLL file can use on All Windowns version
This is because there is some security for parallel ports in all the windows version after Windows ME. IF you want to get parallel port acess in higher versions of windows instal userport. The link below will tell you how to do it **broken link removed**