var
tmpbyte1,tmpbyte2:char;
tmpvar:string;
s:string;
begin
init_plc(1);
s:=edit1.text;
tmpvar:=s+inttostr(fcs(s))+'*'+chr(13);
mscomm.rthreshold:=0;
mscomm.output:=tmpvar;
//向串口输出数据
sleep(1000);// 延时
tmpvar:=mscomm.input;
//从串口读取数据
tmpbyte1:=tmpvar[5];
tmpbyte2:=tmpvar[6];
if tmpbyte1=chr(48)& tmpbyte2:=chr(48);
上一页 [1] [2] [3] [4] [5] [6] 下一页