Subject:
|
Re: I2C device for the RCX
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Sun, 12 Jan 2003 15:02:18 GMT
|
Viewed:
|
842 times
|
| |
| |
> Gunther Lemm wrote:
> > This actually seems to be some sort of 'combined' problem which results from
> > the brickOS-kernel doing task scheduling plus some ROM-internal functions
> > eating up some CPU-time.
> > I did some research on it and came up with a rather evil solution. Take a look
> > at http://lepomux.org/patch.html
>
> well, same problem here, It looks very promising, but it is for motor outputs
> do you think this also works for the sensor ports?
I think it will - as long as you put the sensor handler on timer B (the motor
handler probably can stay there too).
Take a close look at _ds_handler inside the file dsensor.c. That's where all
the active/passive switching and sensor readout is done.
BTW: I took a look at that elektor-I2C-project and in my opinion it doesn't
make much sense to use two sensor inputs. As far as i know I2C would work with
one sensor as SDA and one motorport as SCL if you always use the RCX as master.
The next thing is that the RCX hardware is unable to generate interrupts on the
sensor ports cause they're only connected to A/D inputs of the H8 - so you
always need to poll for data. I guess that polling won't work reliable if you
use multitasking. The only way out would be to implement all of that polling
stuff inside _ds_handler (similar to what I did with the data output in
_dm_handler).
A better soultion would be a device like lepomux as an interface between RCX
and I2C. Data transfer towards the RCX could possibly be done via two sensor
inputs, both transferring 4 bits at a time (as analogue value - 4 bits mapped
with linear sensor values, any other value means no acknowledge). You would
only have to poll once to know if the data you sent was valid and additionally
you would get a whole byte back (in one go).
Happy hacking ;-)
Gunther
|
|
Message has 1 Reply: | | Re: I2C device for the RCX
|
| Before starting the hacking,I did some tests whit this 'for-lus-delay', and I found the results better than expected. I found that this: for(long i=0;i<100000;i++); takes about 120ms, so one for lus takes 0.0012ms. I made a test program which first (...) (22 years ago, 13-Jan-03, to lugnet.robotics)
|
Message is in Reply To:
| | Re: I2C device for the RCX
|
| Hum. i think my first post was not very clear( and whit some stupid mistakes) I think you now how I2C works: there are to lines, SCL and SDA. so whit this device, I got to sensor ports, one for SCL and one for SDA. making high and low signals on the (...) (22 years ago, 12-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
|
|
|
|