To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2274
2273  |  2275
Subject: 
Re: multiplexor and legOS
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Mon, 4 Feb 2002 16:18:06 GMT
Viewed: 
2116 times
  
Don't ask me for a cite, but I seem to remember something about msleep
only having 20ms granularity. If that's the case, your msleep(10) is
either not sleeping at all or is sleeping 20ms, either one of which could
cause problems.

I'd suggest at the very least verifying your timing using sys_time in the
code. If msleep indeed isn't accurate enough, then you could make some
kind of busy-waiting loop.

Thanks, I'd suspected that msleep might not be very accurate but never
considered that it's true granularity could be so large.  I did a quick test
with my current configuration and when I asked msleep to sleep for 12ms it
slept for 20.  This may mean that it does have the 20ms granularity or it could
be a 10ms or some other number.  I also tried the delay function but it was far
worse.  So now I'm just using a simple while loop and watching the value of
sys_time, and my tester function reports that I get exactly the time I'm asking
for.  Of course since I'm using sys_time to test this all it really means is
that my thread isn't being preempted for to long.  Assuming the RCX clock which
sys_time is attached to is decently accurate I guess I have the sleep issue
taken care of.

So I'm back to wondering if the problem is related to the difference in how
LegOS powers and checks sensors vs. how the standard firmware does.  I'm not
sure of the differences yet but it looks like LegOS toggles between powering
and reading a sensor at quite a bit higher rate then the standard firmware
does.  Does anyone know the timings for the power/read cycles on either OS,
I've read them before but can't find the reference.  I'm not sure if this could
cause the problem or not but I'm going to see if I can figure out how to modify
LegOS's sensor power/read cycle to be more like the standard.  I'm guesing this
would all be done in ds_handler but am not yet sure what I'd need to do in
there, mmmm assembly.

As before suggestions are greatly apprecaited.

mark



Message has 1 Reply:
  Re: multiplexor and legOS
 
(...) I don't know about this 20ms granularity and how delay() is going to be any better. Here's the code for each function: //! delay execution allowing other tasks to run. /*! \param msec sleep duration in milliseconds \return number of (...) (22 years ago, 4-Feb-02, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: multiplexor and legOS
 
(...) Don't ask me for a cite, but I seem to remember something about msleep only having 20ms granularity. If that's the case, your msleep(10) is either not sleeping at all or is sleeping 20ms, either one of which could cause problems. I'd suggest (...) (22 years ago, 4-Feb-02, to lugnet.robotics.rcx.legos)

19 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR