Shop OBEX P1 Docs P2 Docs Learn Events
SPI and I2C mixing — Parallax Forums

SPI and I2C mixing

CraigLCraigL Posts: 8
edited 2007-07-15 11:24 in BASIC Stamp
I am attempting to design a data logger with a BS2, DS1302 clock chip, and EEProm 24LC32A.· I think that the 24LC32A requires I2C bus use, and the DS1302 requires SPI bus use.· Is this right?· May I mix them in one set of code?

The only sample code I could find for the 24LC32A was an I2C demo, so perhaps I have the wrong conclusion.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-07-13 19:14
    The 24lc32a is indeed an I2C device and yes you can combine code to do both. I would recommend one of the "p" chips since they have routines for the I2C but you could do it with the BS2 with a little more work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • CraigLCraigL Posts: 8
    edited 2007-07-13 19:34
    Thanks Stephen. When you say a "p" chip, what does that mean?
  • DosManDanDosManDan Posts: 179
    edited 2007-07-13 20:03
    Craig,
    I realize you are working on a BS/2, but I recently posted code in the Completed Projects part of the forum then uses SPI and I2C with an SX-28 Chip using the SX-B BASIC compiler.

    http://forums.parallax.com/showthread.php?p=659734

    I'm using the smaller 24LC16B chip, so most of the stuff should be the same.

    Hope this helps,
    Dan
  • CCraigCCraig Posts: 163
    edited 2007-07-13 20:42
    Or, if you haven't purchased the DS1302 yet, buy a DS1307 and do it all with I2C.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm not scared of your robot. I'm covered by Old Glory (youtube)
  • NewzedNewzed Posts: 2,503
    edited 2007-07-13 20:47
    Craig, I have a Stamp piggyback module that has a DS1302 and an Atmel 4mb EEPROM·that runs on a BS2.· If you are interested you can contact me at Newzed@aol.com.

    Sid




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Yesterday is history, tomorrow is a mystery, and today is a gift.

    That is why they call it the present.

    Don't have VGA?
    Newzed@aol.com
    ·
  • RDL2004RDL2004 Posts: 2,554
    edited 2007-07-14 11:52
    You can also get the eeprom in an SPI version.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Rick
  • CraigLCraigL Posts: 8
    edited 2007-07-14 18:00
    Sid, Dan, CCraig, and Dan,

    Thanks for the help.· I'm off and reading to see if I can understand all this stuff.· It took me a while to even recognize the difference between the SPI and I2c approaches.

    Craig.
  • RDL2004RDL2004 Posts: 2,554
    edited 2007-07-15 11:24
    The "p chips" referred to are the Stamps with a "p" in their number, like BS2p24-IC as opposed to BS2-IC. These have the I2C codes built in to their instruction set. If you're not using one of these, then I2C will be a little more code intensive to use than SPI. I2C doesn't require a separate I/O line for each device, so it will use fewer pins (if everything connecting to the Stamp is I2C capable).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Rick
Sign In or Register to comment.