Solved

parallel ports i/o

Posted on 1997-03-25
7
220 Views
Last Modified: 2010-04-15
I am trying to send data to the parallel port and when i tap the data pins to my breadboard and if i send FFH, i dont get the correct levels. i believe that it has something to do with the extended mode and i was wondering how i can set the parallel ports as input or output pins, ie how do i write the C as currently i think the data pins are configured as output pins and i have to reconfigure them. thank you.
0
Comment
Question by:chien
  • 4
  • 2
7 Comments
 

Author Comment

by:chien
ID: 1249758
Edited text of question
0
 

Expert Comment

by:klos
ID: 1249759
First off, make sure you have an enhanced parallel port.  Obviously, you can do output with any parallel port, but you won't be able to do input (or bi-drectional transfers) with an old parallel port.  Next, make sure the bits in the control register are set according to the direction you want to use.  I use 0xe0 on (base port + 2) for reading, and 0x00 on (base port + 2) for writing.
0
 

Author Comment

by:chien
ID: 1249760
yes, but i was wondering if it should be:

outportb(control_reg, inportb(control_reg) | 0x20);
assumming that control_reg is defined.
if so, i have done that but it still cant work. i am working with a pentium but it doesnt have an enhanced mode.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Expert Comment

by:klos
ID: 1249761
To select the parallel port for READING, use:

    outportb(control_reg, inportb(control_reg)|0xe0)

(using 0x20 should work, but I've seen others that use 0xe0?)

To select the parallel port for WRITING, use:

    outportb(control_reg, inportb(control_reg)&0x1f)

Good luck!
0
 

Author Comment

by:chien
ID: 1249762
i have tried both but it still doesnt work so thanx anyway.
0
 

Author Comment

by:chien
ID: 1249763

0
 
LVL 1

Accepted Solution

by:
white wolf earned 50 total points
ID: 1249764
Ok.  It think you might have another problem to worry about if you tried both methods and it still doesn't work...

1. Are you buffering your port?  You should draw no more then 5mA so use any type of gate, or transistor in saturation/cutoff.

2. Did you check the voltage levels at the input of these gates?  Are they floating?  The parallel is TTL compatible so you should get <0.3V and >4.5V...  If not, make sure your ground wire isn't loose.

3. Are you writing the data so fast that your circuit has trouble settling, or you don't notice that it's working (stupid I know but just checking...)

Let me know...

0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

770 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