On Friday 26 September 2008 21:44:25 [EMAIL PROTECTED] wrote:
> Hello,
>
> I'm trying to implement a class for an I2C device. Therefore I extended
> I2CSensor. So far so good. The class offers me the sendData and getData
> methods, which require a register. Why? I'm no I2C expert but if I
> understand correctly this value is used to address memory!? I don't need
> that, in fact I really don't want that because my device is not memory
> alike and doesn't expect nor can handle this number. It expects a query
> string.

What kind of device is it?

The Lego I2C devices are set up as if they are memory devices. Thus, part of 
every transaction involves sending a register select address.

To write bytes aabbccdd to register nn we send the following:
Start/dev address(write)/nnaabbccdd/stop

To read bytes aabbccdd from register nn we do a dummy write to set the 
address, then do the read:
Start/dev address(write)/nn/stop
Start/dev address(read)/aabbccdd/stop



>
> Did I understand something wrong?
> The register value is added before the data bytes, right? Thus I could
> divert this value to transfer my first data byte?

Possibly so, it will depend on what transactions you are trying to form (eg. 
whether your device can tolerate restarts etc).


>
> Thanks and regards
> Jakob



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Lejos-discussion mailing list
Lejos-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lejos-discussion

Reply via email to