顾客显示屏(串口com接口程序)(100分)

  • 主题发起人 主题发起人 wwwzzz
  • 开始时间 开始时间
W

wwwzzz

Unregistered / Unconfirmed
GUEST, unregistred user!
说明书上:<br>名称:设置应收灯亮 显示命令<br>格式:ASCII &nbsp; ESC &nbsp; s &nbsp; &nbsp;2<br>&nbsp; &nbsp; &nbsp;十进制 &nbsp; 27 &nbsp; 115 &nbsp;50<br>&nbsp; &nbsp; &nbsp;十六进制 1B &nbsp; &nbsp;73 &nbsp;30<br>&nbsp;我用MSComm 和API 都不行,请问如何写??<br>--------------------------------------<br>&nbsp;MSComm1.inbuffercount:=0;<br>&nbsp; MSComm1.InputLen :=0;<br>&nbsp; MSComm1.RThreshold :=1;<br>&nbsp; &nbsp; MSComm1.CommPort := dk ;<br>&nbsp; &nbsp;MSComm1.PortOpen := true ;<br>&nbsp; &nbsp;nr:='ESC s 2' ;<br>&nbsp; MSComm1.Output := nr ;<br>&nbsp; &nbsp; b[0] := 27 ;<br>&nbsp; &nbsp; b[1] := 115 ;<br>&nbsp; &nbsp; b[2] := 50 ;<br>&nbsp; MSComm1.Output := b ;<br>------------API-----------------<br>&nbsp; dataout:='ESC'+ #32+'s'+ #32+'2';<br>WriteFile(hcom,dataout,Length(dataout)+1,buffersize,nil)
 
试下 Chr(27)+'s'+Chr(2)
 
写串口命令,命令的最后要加上CRLF吧,试一下。<br>dataout:='ESC'+ #32+'s'+ #32+'2' + #13#10;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^^加上CRLF<br>WriteFile(hcom, dataout[1], Length(dataout), buffersize,nil)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^^dataout是string,则传入dataout[1],dataout是array,则是dataout[0]
 
后退
顶部