简体   繁体   English

Java RXTX库更改引脚

[英]Java RXTX library change pins

I have to communicate with a device from serial port. 我必须通过串行端口与设备通信。 I am using Java and RXTX library and working on Ubuntu. 我正在使用Java和RXTX库并在Ubuntu上工作。 However, I have a problem: 但是,我有一个问题:

When I get the related serial port's CommPortIdentifier, RXTX library sets all serial port pins(RTS, CTS, DTR, DCD etc.) to high(true) for a short time and then sets the pins to low(false). 当我得到相关串行端口的CommPortIdentifier时,RXTX库会在短时间内将所有串行端口引脚(RTS,CTS,DTR,DCD等)设置为高(真),然后将引脚设置为低(假)。 I understood this via monitoring serial port pins with another program. 我通过监视另一个程序的串口引脚了解了这一点。 The device which I have to communicate collapses because it waits data while RTS pin is high(true). 我必须通信的设备崩溃,因为它在RTS引脚为高电平(真)时等待数据。 I have to restart the device after RXTX library completed its work in order to communicate with it. RXTX库完成其工作后,我必须重新启动设备才能与其通信。

So, here is my question(s): 所以,这是我的问题:

Can I prevent this RXTX library situation? 我可以防止这种RXTX库情况吗? How should I use the RXTX library to control the serial port? 我应该如何使用RXTX库来控制串行端口? I do not want changing pins out of my information. 我不想从我的信息中更改图钉。 Or is there any suggestion about another serial port library for Java which worths to try? 或者是否有关于另一个值得尝试的Java串行端口库的建议?

Thanks... 谢谢...

I have solved my problem. 我已经解决了我的问题。 Now, I am using JSSC for serial port operations. 现在,我正在使用JSSC进行串行端口操作。 It sets all serial port pins to high while opening the serial port and does not change pins anymore out of my information. 在打开串行端口时,它将所有串行端口引脚设置为高电平,并且不再因我的信息而更改引脚。

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

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