简体   繁体   English

检查2个串口是否正常工作

[英]Check if 2 serial ports work correctly

I am struggling to send some bytes from one serial port to another on the same computer. 我正在努力将一些字节从一个串行端口发送到同一台计算机上的另一个字节。 I use this card: http://www.nisuta.com/images/productos/grandes/NS4037.jpg (sun1889). 我使用了这张卡: http ://www.nisuta.com/images/productos/grandes/NS4037.jpg(sun1889)。

I connect them with the following equipment cable: http://www.weisd.com/store2/QVSCC317-06_LR.jpg and adapter: http://www.networktechinc.com/nti/images/items/db9-sl-mf.jpg 我用以下设备电缆将它们连接: http : //www.weisd.com/store2/QVSCC317-06_LR.jpg和适配器: http : //www.networktechinc.com/nti/images/items/db9-sl-mf .jpg

I have written a program in java using JSSC library that's supposed to send the data from one to another exactly as shown in JSSC examples. 我已经使用JSSC库在Java中编写了一个程序,该程序应该完全按照JSSC示例所示将数据从一个发送到另一个。 COM3 reads and COM4 writes. COM3读取,COM4写入。

I have also run 2 instances of JSSC-Terminal assigning com3 to the first and com4 to the other and then sending some chars, but that didn't work either. 我还运行了2个JSSC-Terminal实例,分别将com3分配给第一个实例,将com4分配给另一个实例,然后发送一些字符,但这都不起作用。

How can check that the ports work properly and they don't malfunction? 如何检查端口是否正常工作并且没有故障? Device manager shows 3 ports COM1 , COM3, COM4. 设备管理器显示3个端口COM1,COM3,COM4。 COM1 is the port that exists on motherboard. COM1是主板上存在的端口。

Have you checked that the pinout of that cable is correct for your application ? 您是否检查过该电缆的插针是否适合您的应用? You need a so-called "null-modem" cable, which will cross rx and tx. 您需要一条所谓的“零调制解调器”电缆,该电缆将穿过rx和tx。 This is needed so that PortA.tx (transmit) goes to PortB.rx (Recieve) 这是必需的,以便PortA.tx(发送)转到PortB.rx(接收)

http://ftp1.digi.com/support/images/nmodems.gif http://ftp1.digi.com/support/images/nmodems.gif

There is a good chance that the cable you have is a "straight through" type, since equipment with a female-style connector will have it's rx/tx switched around compared to male-style connectors. 您拥有的电缆很有可能是“直通”类型的,因为与母型连接器相比,带有母型连接器的设备的rx / tx可以切换。 (Devices with one type connector is called DTE and DCE) (具有一种类型连接器的设备称为DTE和DCE)

Here is a good example. 这是一个很好的例子。

http://www.bb-elec.com/Images/whitepaper-images/WhatIsRS232-DCE-DTEPinDiagram.aspx http://www.wut.de/kpics/e-8wwww-17-grus-000.gif http://www.bb-elec.com/Images/whitepaper-images/WhatIsRS232-DCE-DTEPinDiagram.aspx http://www.wut.de/kpics/e-8wwww-17-grus-000.gif

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM