Subject:
|
Re: I2C device for the RCX
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Sat, 11 Jan 2003 18:28:42 GMT
|
Viewed:
|
829 times
|
| |
| |
Steve,
Very good suggestions!
> Note though that there is always a chance that in interrupt from one of
> the peripherals could cause BrickOS to take control of the CPU for a short
> time - so delays may *sometimes* be a little longer than that. So timing
> loops can only ensure that we've waited AT LEAST THE MINIMUM amount of time
> and not that the time is exactly right. That's another reason not to use
> them for longer delays when BrickOS's timers would work.
Bastiaan v.Kesteren,
I second Steve's recommendation, using loops for timing between command
segments. You will not get very far using BrickOS msleep because of the
1ms minimum timing. Also, you may find the assembly lang. command NOP
useful.
Once you get the code setup using timing loops, you may also want to
consider wrapping the critical code segments with a critical section.
Note: there is a special critical section for blocking task swaps. It
is only available to kernel code, but the driver should qualify 8-)
Email me for more information about the critical section (remove spamblock).
I am very interested in the possibilities of this!
// Joe
|
|
Message has 1 Reply: | | Re: I2C device for the RCX
|
| Steve is absolutely right and what he said is exactly what I'd recommend. When writing for loops, you can do the same test as Steve suggested: running the loop x 1000 times and then beep. Divide the stopwatch time by 1000 and you have the timing of (...) (22 years ago, 11-Jan-03, to lugnet.robotics)
|
Message is in Reply To:
| | Re: I2C device for the RCX
|
| (...) Erm...no...you have some trouble with your numbers! 1000us == 1ms so: 4.7us == 0.0047ms !! (...) Yikes! Nooo...ooo! 250ns == 0.25us == 0.00025ms Remember: ms is a millisecond which is 1/1000th second. us is a microsecond which is 1/1000000th (...) (22 years ago, 11-Jan-03, to lugnet.robotics)
|
24 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
|
|
|
|