|
Mark Riley wrote:
> In lugnet.robotics.rcx.legos, Steve Hassenplug wrote:
> > In lugnet.robotics.rcx.legos, Mark Riley wrote:
> > > What you really need to be concerned about is this:
> > > http://news.lugnet.com/robotics/rcx/legos/?n=3078
> > > Basicly, 2/3 of the CPU is being used to sample the sensors at 6.7KHz -
> > Have the changes from the above thread been implemented in a release of BrickOS,
> > yet? (reduced sensor sample rate)
>
> Sorry, nothing has made it to an official release. I think Joseph Woolley has
> some code where he reduced the sample rate to 1KHz (I think). You might try
> contacting him about it.
Mark is correct: I made the following two changes which will cause the
sensors to be polled at 1KHz:
in systime.c; added "bset #0x5,@_AD_CSR:8";
extern void clock_handler(void);
...
sys_nohigh:
mov.w #0x5a06,r6 ; reset wd timer to 6
mov.w r6,@0xffa8
bset #0x5,@_AD_CSR:8 ; start sensor A/D conv
rts
...
in dsensor.c; commented out the same line;
...
; The settle time <snip>...</snip> sensor finish here
; bset #0x5,@_AD_CSR:8 ; go!
rts
...
Note: Each sensor will be polled at (1KHz / 4) since the "start sensor
A/D" is fixed at 1KHz and sensors (including battery level) are polled
one at a time in series.
To modify this timing, you would have to do some fancy work with the
timing of the NMI and the system clock.
If you wanted to poll at 2KHz (or 500 times a second per sensor) you
could set the NMI to fire 2 times a msec, then only increment the clock
every other tick. If you wanted .5Khz (125 times a second per sensor)
you could skip the start sensor A/D every other tick (NMI at 1KHz). etc...
// Joe
|
|
Message has 2 Replies: | | Re: disable LNP
|
| (...) I actually had already tried this, but couldn't get it to work. Turns out I was having a problem with generating the linker file (genlds). Once I resolved that, it works GREAT! As you may expect, the processor intensive program I've written, (...) (21 years ago, 13-Oct-03, to lugnet.robotics.rcx.legos)
|
Message is in Reply To:
| | Re: disable LNP
|
| (...) Sorry, nothing has made it to an official release. I think Joseph Woolley has some code where he reduced the sample rate to 1KHz (I think). You might try contacting him about it. Mark (21 years ago, 11-Oct-03, to lugnet.robotics.rcx.legos)
|
7 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
|
|
|
|