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 / 203
202  |  204
Subject: 
Re: Rom sensor read routine
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Thu, 13 May 1999 20:31:00 GMT
Viewed: 
1304 times
  
Markus L. Noga <noga@inrialpes.fr> wrote:
In my case, since I scan all 4 a/d inputs at once, the one that really
matters is the first one, a/d input a, which corresponds to sensor 2.
Without the delay, I get raw 10-bit values for sensor 2 that are off by a
wildly varying 50-100 units compared to sensors 0 and 1.  With the delay,

The current legOS sensor read cycle is this (i=illuminate, c=A/D
conversion)

S1: iii iii iii ccc
S2: ccc iii iii iii
S3: iii ccc iii iii
S4: iii iii ccc iii

If you find your sensor 2 readings to be still accurate, maybe a better
cycle would look like this:

S1: iii iii --- ccc
S2: ccc iii iii ---
S3: --- ccc iii iii
S4: iii --- ccc iii

The current LegOS model really hammers the sensors, almost to the point of
oversampling them.  It only takes a short while (less than 0.1 ms, I think)
to sample all four sensors; I think LegOS samples the next sensor
immediately after finishing the current one, thus sampling all four sensors
every 0.1 ms, or something like that.  The ROM samples all four sensors in
rapid succession (using the scan mode to do this), but only samples all
four sensors every 3 ms.  My code is similar but samples every 4 ms.

The reason my code needs the delay is because I start A/D conversion at the
same time I turn off power to all four sensors.  There is no fancy timing
to turn off power to the sensors some measurable time before starting A/D
conversion, just the short delay loop.

Because LegOS manages its sensors differently, you can surely turn off the
power to the sensors one phase early, but that is risky in my opinion,
since your duty cycle for charging the sensors is now approaching 50%,
which doesn't seem like enough to guarantee a full charge between sensor
readings, especially if e.g. you are reading a light sensor and the light
source is really bright, which causes the internal capacitor to drain
quickly.  In contrast, the duty cycle used by the ROM is something like
97%, which I am almost certain charges the capacitor fully.

All of this might not matter a whole lot, since I'm not completely sure on
what the implications on the output sensor values are, i.e. I haven't
brought out the scope to quantify the differences, if any.  But it still
seems risky to me for LegOS to use a 50% (or even the current 75%) duty
cycle to charge the capacitor.  What I guess I am trying to say is that
somebody should go out and measure the difference between readings given by
the standard Lego firmware and LegOS if it matters at all that the readings
be similar.

-Kekoa



Message is in Reply To:
  Re: Rom sensor read routine
 
Hi Kekoa, (...) I am fixing this right now. (...) The current legOS sensor read cycle is this (i=illuminate, c=A/D conversion) S1: iii iii iii ccc S2: ccc iii iii iii S3: iii ccc iii iii S4: iii iii ccc iii If you find your sensor 2 readings to be (...) (25 years ago, 2-May-99, to lugnet.robotics.rcx.legos)

3 Messages in This Thread:

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

Custom Search

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