在设备管理器中更改属性 [英] Change properties in device manager

查看:130
本文介绍了在设备管理器中更改属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用串行设备,我想与微控制器通信我的计算机.在我的C#程序中,我可以设置波特率,停止位,数据位等.这些仅在我的C#程序中即可.

i am working with serial device, i want to communicate my computer with microcontroller. In my C# program, i can set the baud rate, stop bits, data bits etc. These just in my C# program.

例如,我在微控制器和C#程序中设置了波特率115200,但是当我在设备管理器中看到设备的属性时,波特率仍使用默认值9600 bps.我不知道通信的好坏,我的C#程序和微控制器使用115200bps,在属性中使用9600bps,但是通信正常.

For example, i set the baud rate 115200 in microcontroller and my C# program, But when i see the properties of my device in device manager, the baud rate is still using default, 9600 bps. I don't know if it is good or no for communication, my C# program and microcontroller using 115200bps, and in the properties using 9600bps, but the communication is working.

如何在设备管理器中更改设备的属性?

How to change the properties of device in device manager?

推荐答案

在C#程序中设置串行端口时,它将使用Win32 SetCommState API进行设置.无论使用哪种串行通信库,都是如此.但是,Win32 SetCommState API将永远不会更改设备管理器中显示的波特率.

When you set up a serial port in your C# program, it will do so using the Win32 SetCommState API. This is true regardless of the serial communications library that you use. However, the Win32 SetCommState API will never change the baud rate that is shown in Device Manager.

设备管理器"中显示的值来自设备的驱动程序,它是在程序中未明确设置时使用的默认值.安装驱动程序后,该值将写入Windows注册表.

The value that is shown in Device Manager comes from the driver for the device, and it is the default value that is used when you don't set it explicitly within your program. The value is written to the Windows registry when the driver is installed.

只要在程序中进行设置,就不必担心设备管理器中显示的值.

As long as you set it in your program, you don't need to worry about the value that is shown in Device Manager.

但是,如果您确实要更改设备管理器"中显示的值,则可以通过更改Windows注册表中的值来完成.

However, if you really wanted to change the value shown in Device Manager, you could do it by changing the value in the Windows Registry.

密钥通常位于此处:

"HKLM \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ Ports"

"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports"

您将更改与您要更改的端口相对应的密钥的值.

You would change the value for the key corresponding to the port that you wish to change.

例如,如果您想更改COM2设置,并且如果"COM2:"键的值为"9600,n,8,1",则可以将其更改为"115200,n,8,1"

For example, if you wanted to change the COM2 settings, and if the "COM2:" key had a value of "9600,n,8,1" you could change it to "115200,n,8,1"

这篇关于在设备管理器中更改属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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