Home > Back-end >  Delphi under xp system how to print port LPT1 according to binary 0 x36, 0 x39, 0 x3c;
Delphi under xp system how to print port LPT1 according to binary 0 x36, 0 x39, 0 x3c;

Time:09-27

Delphi under xp system how to print port LPT1 according to binary 0 x36, 0 x39, 0 x3c; It is best to give a code

CodePudding user response:

Myself,,

CodePudding user response:

 const 
LptData: an array of Char=[0.. 2] (# $36 # $39, # $3 c);

Procedure lptProcess ();
Var
HFile: Cardinal;
ByteWrited: Cardinal;
Overlapped: TOverlapped;
The begin
HFile:=CreateFile (' LPT1: 'GENERIC_WRITE FILE_SHARE_WRITE, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0).
If hFile=INVALID_HANDLE_VALUE then
The Exit;

Overlapped. HEvent:=CreateEvent (nil, False, False, nil);

While True do
The begin
If not WriteFile (hFile, lptData, length (lptData), byteWrited, @ Overlapped) then
Case WaitForSingleObject (Overlapped. HEvent, 4000) of
WAIT_OBJECT_0:;
WAIT_TIMEOUT WAIT_ABANDONED:
The begin
Break;
The end;
The end;
The end;


The CloseHandle (hFile);
The CloseHandle (Overlapped. HEvent);

The end;

CodePudding user response:

Do you have any simple some writing, Pal? I am a rookie, amateur saw half a day, didn't know how to put my thoughts with your statement,
I want to do what is on the parallel port output eight independent square-wave waveform (used to parallel program should be set different number), but the specific what time change the waveform with my sleep (x) to control the output of a waveform after me to calculate the value of x, then output the next, the time interval may be a few hundred milliseconds, may also have a few milliseconds,
  • Related