I recieve many code error from my device so I want to check if the timeouts are right.
This is what I send:
02 39 39 30 31 30 34 30 31 03 30 37 0D 0A
And this is what I recieve:
02 30 30 30 31 30 20 32 30 2B 32 31 35 30 33 2B 32 32 32 38 33 2B 32 33 36 32 33 03 30 31 0D 0A 02 30 30 30 31 30 20 32 30 2B 32 31 35 30 33 2B 32 32 32 38 33 2B 32 33 36 32 33 03 30 31 0D 0A
02 30 30 30 31 30 20 32 30 2B 32 31 35 30 33 2B 32 32 32 38 33 2B 32 33 36 32 33 03 30 31 0D 0AThese are my configurations:
comport.BaudRate = 9600;
comport.DataBits = 7;
comport.Parity = Parity.Even;
comport.Handshake = Handshake.XOnXOff;
comport.RtsEnable = true;
comport.ReadTimeout = 500;
comport.WriteTimeout = 500;
comport.PortName = portname;
How can I calculate if my timeouts are correct?
Sascha BPosted Mar 1, 2012, 5:12 AM
Sam HobbsPosted Mar 1, 2012, 5:10 AM
Sascha BPosted Feb 29, 2012, 7:22 AM
I tried it also with 1000 and 1500 and above but nothing changed.
Then I took an othe adapter :D And it works! The one I used before was a passive USB2Com Adapter by Logilink. It's in the trash now.
Now I use the PA088 from Targus. Works very well.
But for those who don't know how to check if the recieved data is complete I think I got the answer now:
ComWork.ready = false, // Setting it to false so a fresh new value can be recieved
//Check if recieved coe is valid and proceed
[...]
}
VulpesPosted Feb 29, 2012, 7:01 AM
However, setting timeouts is not an exact science. Clearly, they need to be long enough to send or receive all the data in a single transmission which at 9600 kbits/sec is certainly the case here but, if the data is being transmitted spasmodically, you need to allow for the delay(s).
If you're having problems and you suspect the timeouts may be to blame, then I'd see if it makes any difference if you double them.