Solved

parallel ports i/o

Posted on 1997-03-25
7
217 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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 and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

708 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

14 Experts available now in Live!

Get 1:1 Help Now