wirgeld23
asked on
input from parallel port
Hello! can anyone tell me what's wrong with my code? It's supposed to get input from my parallel port. I compiled it with turbo c++. I'm using windows me.
#include <dos.h>
#include <iostream.h>
main()
{
for( unsigned int i = 0; i < 256; i++ )
{
int x = inportb( 0x379 );
cout<<x<<" ****"<<'\n';
sleep( 1 );
}
}
the output i get is:
120 ****
120 ****
... and so on...
this happens even though I put one of the input pins into high logic( 5V ). Can anyone tell me what's wrong? thanks!
#include <dos.h>
#include <iostream.h>
main()
{
for( unsigned int i = 0; i < 256; i++ )
{
int x = inportb( 0x379 );
cout<<x<<" ****"<<'\n';
sleep( 1 );
}
}
the output i get is:
120 ****
120 ****
... and so on...
this happens even though I put one of the input pins into high logic( 5V ). Can anyone tell me what's wrong? thanks!
LPT1 data is at 0x378 ....
ASKER
i thought 0x378(data port) was for output and 0x379(status port) was for input?...(0x37A for control port)
Yes, the status ports are designed for input...
Are you sure that you are accesing the active parallel port.
In some PCs 0x378 is LPT2, 0x278 is LPT3 ... and 0x3BC is LPT1
Are you sure that you are accesing the active parallel port.
In some PCs 0x378 is LPT2, 0x278 is LPT3 ... and 0x3BC is LPT1
Also, a good book for you:
http://www.lvr.com/parprtib.htm
http://www.lvr.com/parprtib.htm
ASKER
i checked my parallel port address. The i/o is in 378. Does that mean I should use 378 even when inputting data? By the way, what am I supposed to get when I use the inp function if I don't input anything? and if I do input 5v in one of the input pins?
ASKER
ps. my parallel port is set to EPP. I read that you can input to pins 2-8( data pins ) in EPP. I tried it but nothing happens.
I see that you've also posted the question under the 'Programming' section.
Please refer to:
https://www.experts-exchange.com/questions/20566532/input-from-parallel-port.html
where more comments have been posted for you.
Mayank.
Please refer to:
https://www.experts-exchange.com/questions/20566532/input-from-parallel-port.html
where more comments have been posted for you.
Mayank.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ/Refund
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Tinchos
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ/Refund
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Tinchos
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.