Solved

parallel ports i/o

Posted on 1997-03-25
7
224 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
[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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
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.

623 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