Windows 中的非标准通信波特率 [英] Non-standard comport baudrates in windows

查看:45
本文介绍了Windows 中的非标准通信波特率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 内置的 com 端口驱动程序是否支持非标准波特率?(实际上,Windows 是否具有用于 com1 和 2 的内置驱动程序?)

Do the windows built in com port drivers support non-standard baudrates? (actually does windows have a built in driver for com1 & 2?)

我问的原因是我无法与使用异常波特率 5787 的设备建立可靠连接.PC 简短地交谈,然后似乎失去了对话,然后又得到了它.一旦发送了一条长消息,它就会在另一端丢失,不久之后对话又回来了.这听起来像经典的波特率不匹配.虽然不够接近可靠,但足够接近一些数据可以通过.

The reason I ask is I'm having trouble getting a reliable connection to a device that uses the unusual baudrate 5787. The device & PC talk briefly, then seem to loose the dialogue, and then get it again. Once a long message is sent, it gets lost at the other end, a short time later the dialogue is back. This sounds to me like the classic baudrate mismatch. Not quite close enough to be reliable though but close enough that some data gets through.

如果我使用便宜的 PCI 串行板,它可以毫无问题地工作.我发现只有使用板载串行的计算机无法正常工作.

If I use an inexpensive PCI serial board it works without problems. It's only computers that use on board serial I've found don't work properly.

推荐答案

PC 中的波特率由 UART 和晶体控制.晶振频率决定了串口可以产生的波特率.波特率通常由 16 分频计数器生成.标准 PC 的晶振频率通常为 1.8432 MHz.将其除以 16 得到 115200,这通常是 com 端口可以做到的最大值.

Baudrates in a PC are controlled by a UART and a crystal. The crystal frequency determines what baudrates the serial port can generate. The baudrate is often generated by a divide by 16 counter. The crystal frequency for a standard PC is normally 1.8432 MHz. Dividing that by 16 gives you 115200 which is usually the maximum the com port can do.

UART 内部是一个 DLAB 寄存器.这进一步分频时钟.所以本质上,要获得 5787 波特,您正在谈论将 115200 除以 5787 得到 19.906687 ...它接近 20,你用 20 加载 DLAB 寄存器.115200/20 给你 5760.因此你可能从 PC com 端口获得 5760 波特.这可能足以导致您看到的问题.

Inside the UART is a DLAB register. This further divides the clock. So essentially, to get 5787 baud you're talking about dividing 115200 by 5787 which gives you 19.906687... It's close to 20 you'd load the DLAB register with 20. 115200 / 20 gives you 5760. Therefore you're probably getting 5760 baud out of the PC com port. That's probably enough of a difference to cause the issue that you're seeing.

这篇关于Windows 中的非标准通信波特率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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