L
lover402
Unregistered / Unconfirmed
GUEST, unregistred user!
对字符发生器写入数据,和一般的对串口写入数据有什么不一样?
只知道字符发生器接口:
用RS232通讯接口
通讯方式:0FAHX1X2X3X40FBH
我想知道数据传送的格式是怎样的?直接传送以上的字符吗?
欢迎指教!
代码如下:
Function Write_RS232(X2,X3:string):Boolean;
var
Err,bufflen,dwlength,lpErrorword;
Write_buffer:array[0..20] of char;
coms:TcomStat;
SendBuffer:string;
flag:boolean;
begin
ClearCommError(hcom,lpError,@coms);
bufflen:=Coms.cbOutQue;
SendBuffer:='0FAH01'+X2+X3+'010BFH';
dwlength:=length(Trim(Sendbuffer));
FillChar(Write_buffer,sizeof(Write_buffer),Ord(' '));
StrPcopy(Write_buffer,Sendbuffer);
flag:=WriteFile(hcom,Write_buffer,dwlength,bufflen,LpOl);
if flag then
Application.MessageBox('发送成功!',pchar('提示'),MB_ok+MB_IconInformation)
end;
end;
//flag为True,
//根据说明,传送X2,X3数据,但屏幕没反应。希望我说的明白。
只知道字符发生器接口:
用RS232通讯接口
通讯方式:0FAHX1X2X3X40FBH
我想知道数据传送的格式是怎样的?直接传送以上的字符吗?
欢迎指教!
代码如下:
Function Write_RS232(X2,X3:string):Boolean;
var
Err,bufflen,dwlength,lpErrorword;
Write_buffer:array[0..20] of char;
coms:TcomStat;
SendBuffer:string;
flag:boolean;
begin
ClearCommError(hcom,lpError,@coms);
bufflen:=Coms.cbOutQue;
SendBuffer:='0FAH01'+X2+X3+'010BFH';
dwlength:=length(Trim(Sendbuffer));
FillChar(Write_buffer,sizeof(Write_buffer),Ord(' '));
StrPcopy(Write_buffer,Sendbuffer);
flag:=WriteFile(hcom,Write_buffer,dwlength,bufflen,LpOl);
if flag then
Application.MessageBox('发送成功!',pchar('提示'),MB_ok+MB_IconInformation)
end;
end;
//flag为True,
//根据说明,传送X2,X3数据,但屏幕没反应。希望我说的明白。