当前位置: 移动技术网 > IT编程>开发语言>.net > 霍尼韦尔1450g二维码扫码枪中文识别。

霍尼韦尔1450g二维码扫码枪中文识别。

2018年11月20日  | 移动技术网IT编程  | 我要评论

重庆土话,斗金传隐藏英雄密码,孙小宝黑吃黑

usb接口模拟com串口驱动程序

hsm usb serial driver

链接: https://pan.baidu.com/s/1aov-fz0oydqgc5dmmkhzgg 提取码: fwgt 


 

霍尼韦尔ezconfig

用来设置扫码枪的程序,需要把扫码枪设置到串口模式。也可以不用这个软件,直接扫码设置。

链接: https://pan.baidu.com/s/1aw4hb-gh6uhuskaqvjswka 提取码: he46 


 

public partial class form1 : form
{
//委托监视端口这个不用多说了吧。
public form1()
{
disp_delegate = new displaydelegate(dispui);
serialport1.datareceived += new serialdatareceivedeventhandler(com_received);
initializecomponent();
serialport1.open();
}
serialport serialport1 = new serialport("com3", 9600, parity.none, 8, stopbits.one);//注意接口名称,不知道为什么,我这个默认接上后是com3
public delegate void displaydelegate(byte[] inputbuf);
public displaydelegate disp_delegate;
void com_received(object sender, serialdatareceivedeventargs e)
{
int len = serialport1.bytestoread;
byte[] inputbuf = new byte[len];
try
{
serialport1.read(inputbuf, 0, len); //读取缓冲区的数据直到“}”即0x7d为结束符
system.threading.thread.sleep(50);
this.invoke(disp_delegate, inputbuf);

}
catch (timeoutexception ex) //超时处理
{
messagebox.show(ex.tostring());
}
}
public void dispui(byte[] inputbuf)
{
richtextbox1.text =encoding.utf8.getstring(inputbuf,0,inputbuf.length);//霍尼韦尔1450g用utf8转就可以了。textbox也有问题,我直接加了richtextbox1倒是没问题。
}

}

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网