Serial Port Woes

2010-01-12 Thread Len Morgan
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


Re: Serial Port Woes

2010-01-12 Thread -= JB =-
I was working on a serial port stack but have been prevented from  
programming
on it for over a year now due to being poisoned and tormented in my  
own home
by a communist nazi like secret society destroying select lives in  
America.


It is unfinished but it does some basic calls.  If you are interested  
I will put it on

the Rev site and allow anyone to use or improve it.

-=JB=-


On Jan 12, 2010, at 7:40 AM, Len Morgan wrote:

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



___
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


Re: Serial Port Woes

2010-01-12 Thread Sarah Reichelt
On Wed, Jan 13, 2010 at 1:40 AM, Len Morgan len-mor...@crcom.net wrote:
 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.


Hi Len,

I have done a lot of work with serial ports, and although I always put
in lots of checks that close  re-open the port if there is an error,
this is not a normal occurrence.

Have a look at my serial test stack
http://www.troz.net/rev/stacks/SerialTest.rev which allows you to
configure the expected line endings as well as all the serial port
parameters. It sends data, and then constantly checks for incoming
responses from the serial device.

Cheers,
Sarah
___
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


Re: Serial Port Woes

2010-01-12 Thread Len Morgan
I'd love to take a stab at finishing it up.  If you have any thoughts on 
what you feel is missing that you didn't get a chance to finish, let me 
know.  Maybe I can release a serial library we could all use.


len morgan

On 1/12/2010 12:26 PM, -= JB =- wrote:
I was working on a serial port stack but have been prevented from 
programming
on it for over a year now due to being poisoned and tormented in my 
own home
by a communist nazi like secret society destroying select lives in 
America.


It is unfinished but it does some basic calls.  If you are interested 
I will put it on

the Rev site and allow anyone to use or improve it.

-=JB=-


On Jan 12, 2010, at 7:40 AM, Len Morgan wrote:

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



___
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




___
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