Var Temp: string; The Irc:
LongWord; Inbuff: an array of Char [0.. 2047]; NBytesRead dwEvent, dwError: LongWORD; Cs: TCOMSTAT;
The begin
Timer4. Enabled:=false; If (hComm=0) then the exit; Temp:=inttostr (xinhao);
^ WriteFile (hComm, PChar (Temp), length (Temp), Irc, nil);
ClearCommError (hComm, dwError, @ CS);
If cs. CbInQue> Sizeof (inbuff) then the begin
PurgeComm (hComm, PURGE_RXCLEAR and PURGE_TXABORT);
exit;
end;
READFILE (hComm inbuff, cs. CbInQue nBytesRead, nil); Temp:=Copy (inbuff, 1, cs. CbInQue); Edit8. Text:='accept' + Temp; Mainly is the realization of single-chip led brightness, now the problem is to send 1 light, after the next send 0 or 1 that was bright, a meeting will only 0 of the lights
But first send 0 is also the same problem,
CodePudding user response:
Don't understand what you said problems not clearCodePudding user response:
Is the forehead, and single chip microcomputer sends data, sending data feeling there will be a repeat send,,CodePudding user response:
Which version of Delphi use? Have a look at the following code linesVar
Temp: AnsiString;
The Irc: LongWord;
The begin
Temp:=AnsiString (inttostr (xinhao));
^ WriteFile (hComm PAnsiChar (Temp), length (Temp), Irc, nil);
end;
CodePudding user response:
When you have a WriteFile, what is the content of the Temp?