简体   繁体   中英

can't read from SerialPort

I'm trying to read a message via serial port (plugged in a RS-422 to my computer by USB)

The problem is that i have 2 cables of this type.

One is a USB straight to 422 and the other one is a usb-RS-232 cable with a RS-232 to RS-422 adapter.

I've installed all the drivers. I write the line: m_Pod.read(response, 0, 1000); where m_Pod is the SerialPort object and response in the byte[] to save the message read.

This line is in an event that if data is received, so I read the message.

The first connector works fine, and I read the message when the event occurs. The second connector, however, doesn't work. The event doesn't occur. If I try to read the message manually, I get a random number (63), instead of the long message I'm supposed to.

This is a picture of the second adapter: http://oi50.tinypic.com/34nh4kz.jpg

On the right is the USB to RS-232 and on the left is the RS-232 to RS-422.

Have you tried playing with Handshake property? http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.handshake.aspx Depending on what signals your adapter is using/providing you might need to select from software/hardware handshaking.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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