发送" Enter]键。通过串口关键 [英] Sending "ENTER" key through serial port

查看:702
本文介绍了发送" Enter]键。通过串口关键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想发送一些命令到我的设备是通过串口连接。如何发送呢?



例如我发现这对谷歌搜索,但对我来说是无用的。



<大骨节病>控制 + <大骨节病>电子是一个快捷键5,所以:

 串口.WRITE(新字节[] {5},0,1); 


解决方案

Microsoft版本进入或新的生产线是 \r\\\
符进行的0x0A 十六进制。



  • \r 是回车

    在外壳或打印机这会把光标回行的开头。

  • \\\
    是换行

    使光标下面一行,在一些弹这也使光标移动到下一行的开头。打印机只会滚动纸位。



这么多的历史课。当前的Windows系统仍然使用这些字符来表示行结束。 DOS按<大骨节病>输入时产生此代码。



关键代码是一个有点不同。与开头的<大骨节病> ESC 键作为1 <大骨节病>输入 28



来源:的 Linux的www.comptechdoc.org

$ b hlkeycodes $ b

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 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 return

    In a shell or a printer this would put the cursor back to the beginning of the line.

  • \n is the line feed

    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.

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

这篇关于发送&QUOT; Enter]键。通过串口关键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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