孤
孤云
Unregistered / Unconfirmed
GUEST, unregistred user!
Comstr:String;
Comcha:Char;
sizbuff:Cardinal;
strbuffchar;
m_Buffchar;
事情是这样的,我从串口中获取数据,
Comstr:='';
WHILE ComPort1.CharReady DO
BEGIN
Comcha:=Comport1.GetChar;
Comstr:=Comstr+IntToHex(Ord(Comcha),2)+' '
Inc(RcData);
END;
然后将获取的字符串付给strbuff,然后进行写操作,
GetMem(strbuff,length(Comstr));
StrPCopy(strbuff,Comstr);
Write(strbuff,sizbuff);
procedure Write(pBuff: PChar
uiCount: Cardinal);
var
i: integer;
begin
for i := 0 to uiCount do
begin
m_Buff[m_uiHead]:=pBuff;//为什么在这地方pBuff付给m_Buff只有一半,如
//pBuff=‘fc 00 00’但m_Buff[1]:=pBuff[1]时,m_Buff[1]=‘f’
m_uiHead := (m_uiHead + 1) mod CN_MAX_BUFFER_SIZE;
end;
end;
请问我哪地方出错了!
Comcha:Char;
sizbuff:Cardinal;
strbuffchar;
m_Buffchar;
事情是这样的,我从串口中获取数据,
Comstr:='';
WHILE ComPort1.CharReady DO
BEGIN
Comcha:=Comport1.GetChar;
Comstr:=Comstr+IntToHex(Ord(Comcha),2)+' '
Inc(RcData);
END;
然后将获取的字符串付给strbuff,然后进行写操作,
GetMem(strbuff,length(Comstr));
StrPCopy(strbuff,Comstr);
Write(strbuff,sizbuff);
procedure Write(pBuff: PChar
uiCount: Cardinal);
var
i: integer;
begin
for i := 0 to uiCount do
begin
m_Buff[m_uiHead]:=pBuff;//为什么在这地方pBuff付给m_Buff只有一半,如
//pBuff=‘fc 00 00’但m_Buff[1]:=pBuff[1]时,m_Buff[1]=‘f’
m_uiHead := (m_uiHead + 1) mod CN_MAX_BUFFER_SIZE;
end;
end;
请问我哪地方出错了!