H
hnzxfboy
Unregistered / Unconfirmed
GUEST, unregistred user!
我用TurboPower Async Professional4.06,下面是我的处理代码,其中DealComData(s)对串口数据的处理,包括数据库的操作等等,现在出现一个情况:当串口数据量过大过快时,有些数据会丢件,请问有经验的各位大大,怎么解决这个问题?
procedure TFrmMain.APROTrigger(CP: TObject; Msg, TriggerHandle,
Data: Word);
var
I : Word;
C : Char;
s : String;
begin
try
case Msg of
APW_TRIGGERDATA :
{got 'login', send response}
;
APW_TRIGGERAVAIL :
{extract and display/process the data}
begin
if JSComData=255 then
JSComData=0
else
inc(JSComData);
s[JSComData]:='';
for I:= 1 to Data do
begin
C := APRO.GetChar;
s:=s+inttohex(byte(c),2);
end;
StatusBar.Panels.Items[1].Text:='接收:'+S;
StatusBar.Panels.Items[3].Text:=s;
DealComData(s);
end;
APW_TRIGGERTIMER :
{timed out waiting for login prompt, handle error}
;
end;
except
end;
end;
procedure TFrmMain.APROTrigger(CP: TObject; Msg, TriggerHandle,
Data: Word);
var
I : Word;
C : Char;
s : String;
begin
try
case Msg of
APW_TRIGGERDATA :
{got 'login', send response}
;
APW_TRIGGERAVAIL :
{extract and display/process the data}
begin
if JSComData=255 then
JSComData=0
else
inc(JSComData);
s[JSComData]:='';
for I:= 1 to Data do
begin
C := APRO.GetChar;
s:=s+inttohex(byte(c),2);
end;
StatusBar.Panels.Items[1].Text:='接收:'+S;
StatusBar.Panels.Items[3].Text:=s;
DealComData(s);
end;
APW_TRIGGERTIMER :
{timed out waiting for login prompt, handle error}
;
end;
except
end;
end;