您好,我想向通过串口连接的设备发送一些命令.怎么寄?
Hi I want to send some command to my device which is connected via serial port. How to send it?
例如,我在谷歌搜索中找到了这个,但对我来说没用.
For example i found this on google search but for me it's useless.
Control + E 是 5 的键盘快捷键,所以:
Control + E is a keyboard shortcut for 5, so:
serial.Write(new byte[]{ 5 }, 0, 1);
微软版的回车或换行是
,即0x0d 0x0a
hex.
The microsoft version of enter or new line is
which is 0x0d 0x0a
in hex.
是回车
在外壳或打印机中,这会将光标放回行首.
In a shell or a printer this would put the cursor back to the beginning of the line.
是换行符
将光标放在一个下面的行,在某些 shell 中,这也会将光标放在下一行的开头.打印机只需稍微滚动一下纸张即可.
Puts the cursor one line below, in some shells this also puts the cursor to the beginning of the next line. a printer would simply scroll the paper a bit.
历史课就讲这么多.当前的 Windows 系统仍然使用这些字符来表示行结束.当按下 enter 时,Dos 会生成此代码.
So much for the history lesson. Current windows systems still use these characters to indicate a line ending. Dos generated this code when pressing enter.
键码有点不同.从 esc 键开始是 1.Enter 是 28.
The key code is a bit different. Beginning with the esc key being the 1. Enter is 28.
来源:来自 www.comptechdoc.org 的 linux hlkeycodes
这篇关于发送“ENTER"通过串口键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!