做一个串口收发的程序,设备要求只有以16进制发送‘02 30 30 30 38 30 30 31 03 35 43’这个,才能收到数据。我用串口调试助手可以收到数据。
程序:
//向串口发送报文
i_ole_comm.OutPut= '02 30 30 30 38 30 30 31 03 35 43'
//接受串口报文
mle_1.text=i_ole_comm.Input
现在不能接收到任何数据
i_ole_comm.OutPut= '02 30 30 30 38 30 30 31 03 35 43' 应该怎么写啊?
------解决方案--------------------
i_ole_comm.OutPut= '02 30 30 30 38 30 30 31 03 35 43'
你这样是发送的字符串,不是二进制流的,需要这个写
blob lb_data
lb_data = blob(char(2)) + blob(char(30)) + ...
i_ole_comm.OutPut = lb_data