Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi COM-Port abfrage abwarten mit der Kompo AsyncPro (https://www.delphipraxis.net/7088-com-port-abfrage-abwarten-mit-der-kompo-asyncpro.html)

Phlight 1. Aug 2003 11:56


COM-Port abfrage abwarten mit der Kompo AsyncPro
 
Hallo zusammen :hi:
habe mir zum Ansprechen einer COM1-Schnittstelle die Kompo von Async Pro besorgt.
Mein Problem ist, dass ich erst einen String sende und dann eine Quittierung abfragen muss, von dem Gerät das am Anschluss hängt, bevor ich den nächsten String senden kann.

Ich muss bis zu 6 Strings mit einem KLICK senden und nach jedem String die Ausgabe vom Getät abwarten bevor der nächste String kommt.
Wie realisiere ich das abwarten und abfragen zwischen den Strings?

Benutze Delphi 6 Pro.

Den ComPort initialisiere und öffne ich schon beim Programmaufruf
Soweit bin ich schon gekommen.
Delphi-Quellcode:
procedure TForm1.ApdComPort1TriggerAvail(CP: TObject; Count: Word);
var
  i:word;
begin
quitstring := '';
for i:=1 to count do begin
  quitstring := quitstring + ApdComPort1.GetChar;
  end;
quitt:=true;
Edit3.Text:=quitstring;
end;

//---------------------------------------------------------------------
procedure TForm1.Button4Click(Sender: TObject);
begin
  ApdComPort1.Output := '@01';
// abfrage quittung;
  ApdComPort1.Output := '@0B65529,0';
// abfrage quittung;
  ApdComPort1.Output := '@0d1000';
// abfrage quittung;
  ApdComPort1.Output := '@0R1';
// abfrage quittung;
  ApdComPort1.Output := '@0B65529,0';
// abfrage quittung;
  ApdComPort1.Output := '@0R1';
// abfrage quittung;
end;
hatte diese Idee.
Delphi-Quellcode:
//----------------------------------------------------------------------
procedure TForm1.quittung;
begin
 while quitt = false do begin
   Button1.Enabled:=false;
   Button2.Enabled:=false;
   end;
 quitt:=false;
 Button1.Enabled:=true;
 Button2.Enabled:=true;
end;
Funzt aber net :wall: !§$%#%"
quitt wird wärend der Schleife von ApdComPort1TriggerAvail nicht aktualisiert.

MfG Phlight


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:09 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz