Link to home
Start Free TrialLog in
Avatar of can9999
can9999

asked on

printer port control..

How can I read data from printer port ?

If the setting is ..
LPT1(0x378)..

And How can I write data ?

It's hurry,,...

Thank U !
ASKER CERTIFIED SOLUTION
Avatar of viktornet
viktornet
Flag of United States of America image

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
also you can use

outp() and outport()

e.g.

outp(0x378, MyData);

outport(0x378, MyData);

There are other functions that I can look up for you if you need them and are similar to these two i just gave you...

The code I sent above was in assembler so you can use it if oyu want, but I think these two functions are easier to use...

-Viktor
--Ivanov
Avatar of can9999
can9999

ASKER

In your code...

you only read from printer port 0x378.

Is there a anything to initial for reading port ?

What is SPP and .. ?

outp(0x37a, 0x20);
^ some people says above line for reading..

Had you trid it ?

oh for reading use

MyData = inp(0x378);

and for writing use

outp(0x378, MyData);

Hope this helps...

-Viktor
--Ivanov
Why did you give me a C? What's wrong with what I said?
I gave you all the needed info... What more do you want?

-Viktor
--Ivanov
Avatar of can9999

ASKER

nothing..

that's enough !

thank U everybody..


What do you mean? I was asking you why you gave me so low grade when I gave you all the needed info?!?!
Avatar of can9999

ASKER

OK !
I'll explain everything..... ^-^

There are several modes for parallel port operating (EPP, BI-DIR, SPP.... etc)
- I don't know what those mean, besides SPP and BI-DIR.

It' is impossible to read data from DATA BUS(d0~d7) of printer port...with using the method what you said alone....

Some steps remain.

1. Set Printer Mode BI-DIR or SPP....
2. Outp(0x37a, 0x20)    <- this command means " I'll read DATA from now "
3. and then READ !
   tmpData = Inp(0x378)

4. If you want to write data,
   Outp(0x37a, 0x00)   <- " I'll write DATA from now "

That's all....


Bye !




 


i just think it wasn't appropriate...