Shop OBEX P1 Docs P2 Docs Learn Events
I2C slave also — Parallax Forums

I2C slave also

RsadeikaRsadeika Posts: 3,837
edited 2006-01-27 16:41 in General Discussion
I am working on a device/sensor that will be based on the SX. I am also trying to figure out how to use SX/B to implemnet the I2C command as it would pertain to a slave device. I asked a similar question about this before, and the answer was, if I read it correctly, the I2C command is only for a master. So, in essence, can not be used in a or for a slave device. Maybe, nobody knows for sure, in the next release of SX/B this will be taken care of.

<edit: I messed up here, this was supposed to be a reply to the I2C slave post>

Ray

Post Edited (Rsadeika) : 1/26/2006 3:59:53 PM GMT

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-26 15:52
    Hi Ray, the problem is that I2C slave just doesn't fit into the SX/B model, you can't just stick a command in to receive a I2C command because an I2C slave is supposed to always be listening. To implement an I2C slave the best way is to stick the code into the ISR and be running a RTCC interrupt to periodically handle the I2C slave in the background. Because code in the ISR is supposed to take a very short amount of time, implementation is still preferably in assembly. There are two downloads·for I2C slave in SX downloads section,·pdf·and code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • RsadeikaRsadeika Posts: 3,837
    edited 2006-01-26 16:43
    Thanks Paul,

    I got all the docs and the example code in asm, I have been looking at that stuff for the last month or so. I got a mix of different examples that show me how to get some of what I need in SX/B, and some of it in asm. The problem is, I want to do it all in SX/B, that way I have a better understanding if something needs to changed or I need to optimise or add some new feature.

    I have gone the route of compiling the SX/B example·part, then looking at the asm lst file, and then trying to figure out the asm part of what I need. My device/sensor is not going to be a snazzy flashing LED. I feel sort of comfortable with the inline aspect of SX/B, but I am finding it very difficult, or near impossible to refit with asm code in an SX/B environment. To bad you can not do inline SX/B within an asm environment. I can hear the asm pros saying "Is this guy nuts!".

    You would think that after all these years their would appear, a language, that would incorporate asm, C or Basic into one, so you would have the best of all worlds, and the best of one, also. Oh, well, more decissions.

    Thanks

    Ray
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-01-27 16:41
    We happen to have another thread in a parallel discussion about this.

    So you want a language called ABC hun?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
Sign In or Register to comment.