- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将与串行设备通信的旧 C 应用程序移植到 C# 中。C 应用程序在设置串行通信时设置以下字段:
newtio.c_iflag = IGNPAR;
newtio.c_oflag = 0;
我没有找到在 C# 中复制此内容的方法,我相信这会导致串行设备在发送“9C”时表现不同。
最佳答案
https://msdn.microsoft.com/en-us/library/system.io.ports.parity(v=vs.110).aspx
Public enum Parity
Even Sets the parity bit so that the count of bits set is an even number.
Mark Leaves the parity bit set to 1.
None No parity check occurs.
Odd Sets the parity bit so that the count of bits set is an odd number.
Space Leaves the parity bit set to 0.
您应该对无
感兴趣
使用此构造函数创建端口:
https://msdn.microsoft.com/en-us/library/system.io.ports.serialport(v=vs.110).aspx
public SerialPort(
string portName,
int baudRate,
Parity parity
)
使用此方法设置奇偶校验值:
https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.parity(v=vs.110).aspx
_serialPort.Parity = SetPortParity(_serialPort.Parity);
关于c# - 相当于使用 C# SerialPort 类设置 termios c_iflag=IGNPAR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42234092/
我有一个 SerialPort 用于连接到虚拟 COM 端口。由于连接是持久的,我必须保留对 SerialPort 的引用,以便打开、关闭和管理端口。我还在我的类上实现了 IDisposable(不是
我正在尝试使用node.js串行端口模块在运行时获取设备的COM端口。 const SerialPort = require('serialport'); var fs = require('fs')
我目前有一个使用 VB6 代码制作的程序,该程序使用 MSCOMM 控件从串行端口拉回数据。这成功地从我的串行端口接收数据,其中连接了 Denso BHT-904B 设备。 我现在正尝试将此代码移至
从 SerialPort 对象外部看,写入缓冲区的大小以及是否已满似乎没有区别。 使用同步写入,write 方法会阻塞,直到所有数据都已发送且缓冲区为空。 使用异步写入,数据排队,程序继续运行。直到写
我正在用 C# 开发一个 .NET 4.0 WPF 应用程序,它通过 RS232 控制电机。我在退出应用程序时遇到问题,应用程序有时会在关闭端口时死锁。 在互联网上进行一些研究后,我注意到这是一个常见
这个问题的灵感来自这里的问题和答案: Passing a Command to a Comm Port Using C#'s SerialPort Class 这个问题本身回答了我遇到的一些问题,但也
假设我们有以下代码: SerialPort port = new SerialPort("COM2", 115200); port.Open(); // Thread.Sleep(5000); //
使用串行端口库的人注意到了这一点,还是只有我?我发现(非常)很少有人处于相同的情况,但我没有找到解决方案。 这是我使用 ruby serialport 得到的示例: ff d8 ff e0 00
我正在使用 Ruby 1.8.7 SerialPort gem 通过 FTDI232 USB 转串口转换器与 AVR 通信。我似乎遇到了 SerialPort 初始化新 SerialPort 的问题。
我正在开发需要与 COM 端口交互的程序。 从这个问答中学习:.NET SerialPort DataReceived event not firing , 我这样写我的代码。 namespace C
我正在监听串口 5 个字节的信息。轮询的完整答案需要 5 个字节。我的代码监听 serialport data_received 事件并检查 bytesToRead。有时,事件会触发并且 bytesT
我有一个 USB 电话连接到我的电脑上 我如何使用串口检测它所在的 COM? 最佳答案 遍历所有 COM 端口并尝试从每个端口获取一个标识。下面是一个最小的示例,应该对其进行扩展以进行更好的错误检查等
因为我是多线程应用程序的新手,所以我想在开始编写代码之前从更有经验的人那里得到一些建议... 我需要在串口事件中对串口接收到的数据进行排队,以便进一步处理。 所以我有以下事件处理程序: voi
我正在开发需要与 COM 端口交互的程序。 从这个问答中学习:.NET SerialPort DataReceived event not firing , 我这样写我的代码。 namespace C
偶尔,我的一些集成测试会因上述消息而失败。我正在使用下面的代码来准备端口。 for(int i = 0; i < 5; i++) {
我有两个设备想通过串行接口(interface)连接,但它们的连接不兼容。为了解决这个问题,我将它们都连接到我的 PC,并且我正在开发一个 C# 程序,它将 COM 端口 X 上的流量路由到 COM
我在尝试让串行端口接收正确消息时遇到了很多问题。它不断截断消息。这是我的代码,我将在代码之后尝试详细说明。 public SerialComms(SerialPort sp) { this.sp
我正在使用串行通信,我想知道是否应该保持 SerialPort 打开? 我正在创建一个命令队列,一次只会运行一个。我应该创建一个 SerialPort 并在每个命令中打开/关闭它,还是应该有另一个类来
我一直在尝试使用模块 Win32::SerialPort在 perl 5.10 (也许它与 5.14 有一些问题)。我必须向串行端口发出命令并获取它们的输出。我已经发现 write 将为我完成前面的部
我有一个 WPF 测试应用程序,用于评估基于事件的串行端口通信(与轮询串行端口)。问题是 DataReceived 事件似乎根本没有触发。 我有一个非常基本的 WPF 表单,其中包含用于用户输入的 T
我是一名优秀的程序员,十分优秀!