Problem reading multiple serial ports using SerialDataReceivedEventHandler
I have two devices that stream data to my application. One device that continually streams 9 byte data packets terminated with '\r\n' at a rate of 1 packet each 50 ms to COM1. The second device sends a 38 byte packet terminated with '\r\n' to COM3 only when the device is triggered.
Each has a completely different SerialDataReceivedEventHandler and each runs in it's own dll puting them in different threads.
The COM1 SerialDataReceivedEventHandler always performs well.
The COM3 SerialDataReceivedEventHandler will p开发者_StackOverflow中文版erform well if no data is streaming into COM1.
However, when the COM1 SerialDataReceivedEventHandler is operating and the COM3 SerialDataReceivedEventHandler is operating, the COM1 SerialDataReceivedEventHandler fires immediately when data is available but the COM3 SerialDataReceivedEventHandler takes up to 12 seconds to fire when data is available.
Is the COM1 SerialDataReceivedEventHandler keeping the COM3 SerialDataReceivedEventHandler from firing? Or maybe something else is happening under the SerialDataReceivedEventHandler hood? Any ideas?
By default, COM1 and COM3 both use the same interrupt line to signal when data shows up, assuming these are real serial ports. Can you configure one of the ports to be COM2 or COM4? COM1 & COM3 both share IRQ 4 while COM2 & COM4 share IRQ 3.
You may be able to look at this with Device Manager (you can run devmgmt.msc to start it up).
精彩评论