Hi,
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!
take a look at the control util here :
http://www.geocities.com/g
Main Topics
Browse All TopicsI need to use a standard parallel port (not ECP, not EEP) to turn on and off a relay/LED, therefore, I need to maintain the status of a specific pin for serval seconds or minutes.
How can I do it if i connect this relay/LED to LPT1 (378H) first pin (D0) on Win2k ? Could you give me some Delphi 6 sample code for that ?
Thanks,
Andrew
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi,
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!
take a look at the control util here :
http://www.geocities.com/g
try this link to download source and example :
http://www.specosoft.com/e
ULN-2803A IC is a valid way of doing things (AmirAzhdari)
Another way (which might eliminate the need for a relay, depending on your application) is to use an optoisolator
http://en.wikipedia.org/wi
Practically speaking, I mean:-
http://www.electronicsurpl
Hi!
If you use a relay, put a didode inverse polarised, in parrallel with the coil, for avoid the inductive return, this is sufficient for make home things...
For example one diode 1N-4148 is sufficient for this porpouse.
In a proffesional circuit you must use any optical separation (optocoupler) for protect your pc.
ULN-2803 is a darlington transistor cell, used for attack a bigger relay (or a relay of other voltage), but... it doesnt a good isolator.... is just 'brute force' for your port :)
Here you have software examples for access ports in W2k/Xp:
http://www.q3.nu/trucomani
There is other solution: Solid States Relays. This components/packs/circuits contains all you need, has 'force brute', galvanic isolation, and fast & without noise conmutation but... are something expensives for make tests at home... :)
Dear andrewyu
i have see you asked that question before , just take a look at posted comment from Johnjces to know how to use createfile and...
http://www.torry.net/vcl/s
http://www.experts-exchang
regards
Let's say you wanna send a bunch of bytes:
var
s: string;
LPTHandle: THandle;
bytesWritten: Integer;
begin
LPTHandle := CreateFile('LPT1', GENERIC_WRITE, 0, PSecurityAttributes(nil),
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
if LPTHandle = INVALID_HANDLE_VALUE then
raise Exception.Create('Unable to open handle for LPT1!');
s := 'Some string'; // or you can send a bunch of bytes such using s := #12#13#14;
WriteFile(LPTHandle, PChar(s)^, Length(s), bytesWritten, nil);
end;
Hi, DragonSlayer,
I still cannot work with following codes, what seems to be the problem ?
Thanks,
Andrew
HandleFile:= CreateFile('LPT1',
GENERIC_WRITE,
0,
PSecurityAttributes(nil),
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
0);
if HandleFile= INVALID_HANDLE_VALUE then
begin
raise Exception.Create('Unable to open handle for LPT1!');
end;
WriteFile(HandleFile, PChar(#0)^, 1, NumberWritten, nil);
OR
WriteFile(HandleFile, PChar(#1)^, 1, NumberWritten, nil);
CloseHandle(HandleFile);
Business Accounts
Answer for Membership
by: moorhouselondonPosted on 2005-09-16 at 02:50:40ID: 14896653
Do you literally mean a Relay? I would isolate the relay totally from the pc, the inductive "kick" can cause damage to the pc.