Solved

parallel ports i/o

Posted on 1997-03-25
7
222 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert image to byte array 8 209
How to get time_t value that is a week old 6 169
Inorder binary search tree 5 173
How to set environment variables in C 2 86
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them 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.

828 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