?
Solved

input from parallel port

Posted on 2003-03-28
9
Medium Priority
?
294 Views
Last Modified: 2013-11-15
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!
0
Comment
Question by:wirgeld23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 6

Expert Comment

by:Mafalda
ID: 8226147
LPT1 data is at 0x378 ....
0
 

Author Comment

by:wirgeld23
ID: 8228985
i thought 0x378(data port) was for output and 0x379(status port) was for input?...(0x37A for control port)
0
 
LVL 6

Expert Comment

by:Mafalda
ID: 8230031
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
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Expert Comment

by:Mafalda
ID: 8230032
Also, a good book for you:
http://www.lvr.com/parprtib.htm
0
 

Author Comment

by:wirgeld23
ID: 8230541
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?
0
 

Author Comment

by:wirgeld23
ID: 8230663
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.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8236600
I see that you've also posted the question under the 'Programming' section.

Please refer to:

http://www.experts-exchange.com/Programming/Q_20566532.html

where more comments have been posted for you.

Mayank.
0
 
LVL 9

Expert Comment

by:tinchos
ID: 9566385
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
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9618364
PAQed, with points refunded (20)

Computer101
E-E Admin
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Invest in your employees with these five simple steps to improve employee engagement and retention.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question