Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic I2C Routines — Parallax Forums

PropBasic I2C Routines

train nuttrain nut Posts: 70
edited 2011-12-02 18:41 in Propeller 1
Has anyone out there written any routines in propbasic to handle I2C operations to EEPROM? The manual is not very specific about the variables.

Ben

Comments

  • blittledblittled Posts: 681
    edited 2010-12-07 18:05
    Try the OBEX under the Protocol heading for a couple of I2C routines that may be helpful. Here's one to get you started: http://obex.parallax.com/objects/26/
  • train nuttrain nut Posts: 70
    edited 2010-12-07 18:14
    The problem I am having is that in probasic the only variables are longs and the I2C calls require you to send bytes. So how do you send bytes? Bean or Jonny Mac are you watching?

    Ben
  • JonnyMacJonnyMac Posts: 9,198
    edited 2010-12-07 18:18
    Keep in mind that you don't have to TX all 32 bits in a long -- you can send only the eight required and that's what the I2C routines do. And when you WRBYTE to get a value to the hub, you're only writing the eight LSB bits.

    [Edit] I just looked at the code generated by I2CWRITE and it does indeed send just the lower eight bits of your variable. If you look carefully you'll see that the value to write is moved into __temp3 and then shifted left by 24 bits. This moves the lower eight bits to the MSB bits position (31..24); this is required to send the bits MSB first.
  • train nuttrain nut Posts: 70
    edited 2010-12-08 09:56
    Thank you JonnyMac for a quick and precise response. I think I can handle it from here.

    Thanks again

    Ben
  • G McMurryG McMurry Posts: 134
    edited 2011-12-01 19:26
    Train Nut...

    I know this was a year ago, but what ya up to? Are you doing something with the propeller for model railroad?

    G
  • BigFootBigFoot Posts: 259
    edited 2011-12-02 18:41
    Train Nut...

    Its too bad Parallax dosent have a Prrop1 chip in a smaller package with less I/O.
    It would make a great DCC decoder with sound.
Sign In or Register to comment.