[已解决]串行端口读取 [英] [Solved] Serial Port Read

查看:86
本文介绍了[已解决]串行端口读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自动执行一些串行端口命令.目前,我可以通过串行电缆连接到linux设备并发出命令.很好,没问题.我想做的是编写一个C#应用程序,该应用程序会将相同的命令发送到设备并接收 答复.

Hi, I am trying to automate some Serial port commands. Currently I can connect to a a linux device via serial cable and issue commands. Great, no issue. What I want to do is write a C# application that will send the same commands to the device and receive responses. 

示例:

我使用腻子连接到COM10上的串行设备并发送"ls -l",腻子在窗口中显示了输出.我有一个简单的C#应用​​程序,它使用SerialPort发送相同的命令,但返回的唯一输出是相同的"ls -l". 我希望te在"ls -l"之后收到该文件夹​​的内容.被执行.

I use putty to connect to serial device on COM10 and send "ls -l", putty shows me the output in the window. I have a simple C# application that uses the SerialPort to send the same command, but the only output I get back is the same "ls -l". I am expecting te receive the contents of that folder after the "ls -l" is executed.

我想念什么?任何建议将不胜感激.

What am I missing? Any advice would be much appreciated.

亲切的问候

推荐答案

找到了它.我缺少ASCII 13和ASCII 10字符来通知新行.
Found it. I was missing the ASCII 13 and ASCII 10 characters to notify about new line.


这篇关于[已解决]串行端口读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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