?
Solved

writing to parallel port in windows NT

Posted on 2003-03-14
6
Medium Priority
?
232 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
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…

601 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