Shop OBEX P1 Docs P2 Docs Learn Events
SPIN i2c object and 6 examples (code) - Updated v1.2 — Parallax Forums

SPIN i2c object and 6 examples (code) - Updated v1.2

JavalinJavalin Posts: 892
edited 2007-02-14 08:06 in Propeller 1
All,

Attached is a SPIN project achieve that implements single a master I2C SPIN object.· I've also included six device objects and a·basic LCD (for debug) object.· The objects demo the the popular·i2c-bus and·devices:
·· -> DS1307 - real time clock
·· -> DS1621 - temperature sensor
·· -> 24LC256 - i2c serial EEPROM
·· -> (NEW v1.2) MD22 Motor Controller (http://www.robotelectronics.co.uk)
·· -> (NEW v1.2) SRF08 Ultrasonic Sensor (http://www.robotelectronics.co.uk)
·· -> (NEW v1.2) MCP23016 - i2c I/O Expander

This is provide free to Parallax Propeller users - I'll provide some support if you post to this thread.

Future development work I intend will be to add objects for the:
··· -> Multi-Master arbitration if I can find another master that implements arbration, and get my hands on a decent O-Scope!!
··· -> ASM version for speed! - when the manual is released (hint,hint)
·- so (keep) watching this space

I've fairly fully tested these libraries, but I'd appriate any feedback from you all!· If you run it multi-cog watch out for the multi-cog IO pin rules!

The device libraries are fairly light on functions and can be expanded to provide all device functions.

Questions, comments and·feedback is welcomed!

Enjoy!

James

Updated:
· version 1.1 - slight tidy up. Doc & Code.
· version 1.2 - slight tidy up. Doc & Code.· Added MD22, SRF08 and MCP23016 objects.· General improvements

Post Edited (Javalin) : 5/15/2006 8:14:58 PM GMT

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-05-07 22:56
    Excellent job James! Didn't take you long [noparse]:)[/noparse] This helps a lot since I've been considering the 1307 for a project.

    Look for my mail outside here...
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    Southern Illinois University Carbondale - Electronic Systems Technologies

    Personal Links with plenty of BASIC Stamp info
    StampPlot - Graphical Data Acquisition and Control
  • JavalinJavalin Posts: 892
    edited 2006-05-07 22:58
    Hi Martin,

    Thanks. I've been working 12+ hours a day on it since Friday! Going to work next week to sleep!

    The propeller rules!

    Will do.

    James
  • JavalinJavalin Posts: 892
    edited 2006-05-15 19:49
    All,

    Library update.

    James
  • Ym2413aYm2413a Posts: 630
    edited 2006-05-23 06:26
    Wow James. That's really cool.
    I2C is so useful, I'm glad someone wrote an object for it so fast.
    I can't wait until I get my Propeller in the mail! This little thing seems so cool.

    --Andrew "A"
  • Stan671Stan671 Posts: 103
    edited 2006-05-24 00:17
    Thank you, James. I was going to use another EEPROM to store some data and the DS1307 RTC and the 1621 temp sensor anyway, so you have done me a great service. Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Stan Dobrowski
  • JavalinJavalin Posts: 892
    edited 2006-05-24 13:00
    Thanks chaps, let me know how you get on.......
  • LitefireLitefire Posts: 108
    edited 2007-02-14 03:28
    hey, i've been having some trouble with I2C. I've got a propeller (duh!) and an MD23 (same company as the MD22 that you've shown here) motor controller board. But try as i may, i just cannot get the MD23 to cooperate.

    Here's my current setup:

    A3 -> SDA w/ pullup resistor (to 3.3V)
    A4 -> SCL w/ pullup resistor (to 3.3V)

    I've tried to get help with this before, but i just cannot fathom what could be wrong with it. I even tried with my trusy BS2 and a similar sample program... but there just isn't any love here.

    When i get home i'll get some of the code i've been using up and running... since you've been working with the MD22, i was hoping you could help at least a little.

    ~~Brian
  • JavalinJavalin Posts: 892
    edited 2007-02-14 08:06
    Hi Brian,

    Well I can try!! Have you downloaded version 1.3 of the library?

    From a wireing side, you should have the MD23 powered by +5V and the SDA/SCL connected to the propeller's pins as shown for the +5V devices in the i2cDemoApp.spin

    Then I suggest to prove the circuit you edit the i2cDemoApp.spin file to only run the i2cScan and edit it to output to a TV or serially to your PC etc. It should show an ACK on 0xB0 (176 decimal)
    Let me know how you get on.

    James
Sign In or Register to comment.