Lego Mindstorm and Squeak

Ned Konz ned at bike-nomad.com
Sat Mar 30 16:27:53 UTC 2002


On Saturday 30 March 2002 07:16 am, Bergel Alexandre wrote:
> Thanks Ned for your answer,
>
> But I have done something similar (cf RCXSerialPortReader class) I guess.
> I really do not understand why I have a different behavior if I use a VM
> with O_NONBLOCK ?

First, have you tried using the VM changes I supplied? I don't know why 
you're able to read any bytes at all without the CREAD bit set.

With the VM you have, VMIN is set to 1, and VTIME is set to 5.

MIN represents the minimum number  of  characters  that  should  be
       received  to satisfy the read. TIME is a decisecond-valued
       timer. When both are set, a read will wait until at  least
       one  character  has been received, and then return as soon
       as either MIN characters have been received or  time  TIME
       has  passed since the last character was received.

So if you set blocking mode and use the VMIN and VTIME values that you have, 
a read will return when either:

* 1 character or more has been received, or
* at least 50msec has passed since the last character.

It's up to you. But I would try making sure that the CREAD bit was set.

If I get some time, I may try your code with my RCX.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com



More information about the Squeak-dev mailing list