?
Solved

writing to parallel port in windows NT

Posted on 2003-03-14
6
Medium Priority
?
221 Views
Last Modified: 2010-04-04
hi ,
how i can write a byte of data to parallel port in windows NT ( without using components ) ?


Thanks you very much.

regards,
Amir
0
Comment
Question by:Amir Azhdari
[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
6 Comments
 
LVL 3

Expert Comment

by:emadat
ID: 8137654
Hi Amir,

Here is an article called "Using the Parallel Port as an Input/Output Channel":
http://digital.ni.com/public.nsf/websearch/953a4ab52663089d85256427004778c4?OpenDocument

And here are some procedures to write, reset and read parallel port:
//********************************************************
procedure WriteToPort(PortAddress, DataValue: Word);
begin
    DataValue := (DataValue*256) + DataValue;
    asm
        Mov ax, DataValue
        Mov dx, PortAddress
        Out dx, ax
    end;
end;
//********************************************************
procedure ResetPort(PortValue: word);
begin
    asm
        Mov ax,0
        Mov dx,PortValue
        Out dx,ax
    end;
end;
//********************************************************
function TBAIOPort.ReadPort(PortValue: word): word;
var
    ReadData: word;
begin
    asm
        Mov dx, PortValue
        In ax, dx
        Mov ReadData, ax
    end;
    Result := Byte(ReadData);
end;
//********************************************************

Good luck,
Emad
0
 
LVL 5

Accepted Solution

by:
Gwena earned 400 total points
ID: 8139983
get zlportio .. it's a delphi unit and a tiny 3kb sys file that lets you work easily with the ports..

it is sooo easy to use!

I just published a lpt port controler 3 days ago that uses this.. take a look at the control util here

http://www.geocities.com/gacarpenter386/portie.zip

you have to right click the link to the file and select
'save target as' to download it.. geocities is funny about dl'ing files directly unless you are at the website :-/

I can send you the source for this if you need it :-)

0
 
LVL 6

Author Comment

by:Amir Azhdari
ID: 8142460
Dear Gwena
can you send me your source code Please ?
my email : azhdari@lycos.com

Thank you Gwena... you really helped me.
0
Technology Partners: 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!

 
LVL 9

Expert Comment

by:ginsonic
ID: 8144236
Gwena have you deleted the file from server? Can't download it :(
0
 
LVL 6

Author Comment

by:Amir Azhdari
ID: 8145479
Hi ginsonic
you have to right click the link to the file and select
'save target as' to download it..
0
 
LVL 5

Expert Comment

by:Gwena
ID: 8145710
Hi AmirAzhdari :-)

I will send the code to your email
It was compiled using D2 standard
and there is a component you would need
to handle the fancy form shape...

But the main unit code will show you exactly
how to make easy use of zlportio

oh... also a small util I wrote would be needed to
stuff the zlportio.sys into the compiled exe so that
it can be extracted at runtime with my exemod.pas unit

exemod.pas is in the source code...

any questions about the source just ask... I did not
comment it :-)
0

Featured Post

Technology Partners: 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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