Solved

parallel ports i/o

Posted on 1997-03-25
7
218 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Statment to match two tables in c# 6 77
Want to delete all my personal data 13 138
How to access ANSI/IEEE Std 754 or equivalent information ? 3 45
How to learn Linux? 10 43
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…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now