Shop OBEX P1 Docs P2 Docs Learn Events
Tutorial on I2C w/ BS2 — Parallax Forums

Tutorial on I2C w/ BS2

CruxCrux Posts: 74
edited 2007-03-15 22:42 in BASIC Stamp
Hello guys I need a simple tutorial on I2C using BS2. Some advice me to refer to the nuts and bolts article title: "I2C For Fun",I still find it hard to comprehend so if you some of you knows how to do it. I would be very grateful if you share it to me.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-15 03:37
    Nuts and Volts columns 79, 85, and 115 go into a lot of detail about using I2C with a BS2. There's a link to Phil Anderson's website in column 79 that has some other information on I2C and links to various manufacturer's websites. If you have specific questions, feel free to ask, but the Nuts and Volts articles are about as simple as you can get.
  • metron9metron9 Posts: 1,100
    edited 2007-03-15 17:57
    Not a tutorial but working code with comments

    http://forums.parallax.com/forums/default.aspx?f=21&m=144987

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • sdysdy Posts: 40
    edited 2007-03-15 22:42
    Writes data to 24LC32 EEPROM memory chip:
    Here's I2C code for writing/read an I2C EEPROM, a 24LC32:

    Writes data to EEPROM:

    ' 24LC32EEPROM SDA on 8; SCL on 9
    I2Cpin CON 8
    Wr2432 CON %10100010 ' write to 24LC32
    addr VAR Word ' EE address
    data VAR Word

    addr = addr+1
    I2COUT I2Cpin,Wr2432,addr.HIGHBYTE\addr.LOWBYTE,[noparse][[/noparse]data]



    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Reads tIn from 24LC32 EEPROM memory chip:

    Taddr VAR Word ' EE address
    Rd2432 CON Wr2432 | 1 ' read from 24LC32
    tIn VAR Byte ' value read from EEPROM

    Taddr=Taddr+1
    I2CIN I2Cpin,Rd2432,Taddr.HIGHBYTE\Taddr.LOWBYTE,[noparse][[/noparse]tIn] 'read back
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sign In or Register to comment.