发送“ENTER"通过串口键

Sending quot;ENTERquot; key through serial port(发送“ENTER通过串口键)
本文介绍了发送“ENTER"通过串口键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想向通过串口连接的设备发送一些命令.怎么寄?

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"通过串口键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)