![]() |
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:
hatte diese Idee.
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;
Delphi-Quellcode:
Funzt aber net :wall: !§$%#%"
//----------------------------------------------------------------------
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; quitt wird wärend der Schleife von ApdComPort1TriggerAvail nicht aktualisiert. MfG Phlight |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:25 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz