无法通过rs-232 serialPort execll品牌设备从称重秤读取重量 [英] can not read weight from Weighing Scale via rs-232 serialPort execll brand device

查看:75
本文介绍了无法通过rs-232 serialPort execll品牌设备从称重秤读取重量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我希望体重秤的重量为 SerialPort ,不含
DataReceived
事件这种方式适用于其他品牌但不适用于此品牌我的串口配置如下:

i want read weight from Weighing Scale with SerialPort without DataReceived event this way works for other brand but not working in this brand my configuration for serial port is like below:

       公共字符串GetWeight()

        {

            var result = string.Empty;

            var comPort = new SerialPort(" COM1",9600,Parity.None,8,StopBits.One);

             comPort.ReadTimeout = 10000;

            comPort.Open();

            var b = string.Empty;



            result = comPort.ReadExisting(); //
comPort.ReadLine();和...



            comPort.Close();

           返回结果;
$


        }

comPort 的Read方法没有读取数据并抛出
操作超时


none of Read method of comPort doesn't read data and throw operation Timed out

推荐答案

串口访问可能会出现很多问题。 您是否尝试过使用TeraTerm等串口应用程序来证明它正在发送数据并以9600波特率发送? 您不必发送"触发器"命令
让它发送? 请记住,根本没有缓冲。 如果字符串发送时端口未打开,则会丢失它。
There are many things that can go wrong with serial port access.  Have you tried using a serial port application like TeraTerm to proe that it's sending data, and sending it at 9600 baud?  You don't have to send a "trigger" command to get it to send?  Remember that there's no buffering at all.  If the port isn't open when the string sends, you lose it.


这篇关于无法通过rs-232 serialPort execll品牌设备从称重秤读取重量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆