I'm having a lot of trouble consistently reading a serial port. I'm trying to talk to a microcontroller using ModBus ASCII and the basic idea is to send a request for data (about 12 bytes) and then wait for an answer (about 300 bytes). There is between a 1/4 and 1/2 second delay from when I send the command and the controller STARTS sending it back.

I also can't get it to work at all if I open it for update (either text or binary). I have to open the com port, send the command, then close the port and reopen it for read to get anything at all.

I've tried "until linefeed", "until empty", "until eof", "for 1 line", etc. and none of them seem to work reliably. I KNOW that a response ends with a CRLF pair and there is only ever 1 "line" in a response so if I could just wait until I got the LF and it happened in say 3 seconds or less, I'd be happy.

Any suggestions??

len morgan
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to