Link to home
Start Free TrialLog in
Avatar of chien
chien

asked on

parallel ports i/o

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.
Avatar of chien
chien

ASKER

Edited text of question
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.
Avatar of chien

ASKER

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.
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!
Avatar of chien

ASKER

i have tried both but it still doesnt work so thanx anyway.
Avatar of chien

ASKER


ASKER CERTIFIED SOLUTION
Avatar of white wolf
white wolf

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial