发送" Enter]键。通过串口关键 [英] Sending "ENTER" key through serial port
问题描述
您好我想发送一些命令到我的设备是通过串口连接。如何发送呢?
例如我发现这对谷歌搜索,但对我来说是无用的。
<大骨节病>控制骨节病> + <大骨节病>电子骨节病>是一个快捷键5,所以:
串口.WRITE(新字节[] {5},0,1);
Microsoft版本进入或新的生产线是 \r\\\
是
符进行的0x0A
十六进制。
-
\r
是回车在外壳或打印机这会把光标回行的开头。
-
\\\
是换行
使光标下面一行,在一些弹这也使光标移动到下一行的开头。打印机只会滚动纸位。
这么多的历史课。当前的Windows系统仍然使用这些字符来表示行结束。 DOS按<大骨节病>输入骨节病>时产生此代码。
关键代码是一个有点不同。与开头的<大骨节病> ESC 骨节病>键作为1 <大骨节病>输入骨节病> 28
来源:的 Linux的www.comptechdoc.org
$ b hlkeycodes $ bHi 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 is a keyboard shortcut for 5, so:
serial.Write(new byte[]{ 5 }, 0, 1);
The microsoft version of enter or new line is \r\n
which is 0x0d 0x0a
in hex.
\r
is the carriage returnIn a shell or a printer this would put the cursor back to the beginning of the line.
\n
is the line feedPuts 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.
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.
The key code is a bit different. Beginning with the esc key being the 1. Enter is 28.
Source: linux hlkeycodes from www.comptechdoc.org
这篇关于发送" Enter]键。通过串口关键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!