Shop OBEX P1 Docs P2 Docs Learn Events
I2C Ports on 32910 Propeller Activity Board? — Parallax Forums

I2C Ports on 32910 Propeller Activity Board?

oakguyoakguy Posts: 21
edited 2013-09-17 15:52 in General Discussion
I have the HCM5883L compass board that requires or calls for attachment to the SDA and SCL ports. I don't see those ports are available. Is there a work around for the using data pins instead? Researching myself but I thought I might query the board!

Thanks

Comments

  • dgatelydgately Posts: 1,630
    edited 2013-09-16 11:49
    oakguy wrote: »
    I have the HCM5883L compass board that requires or calls for attachment to the SDA and SCL ports. I don't see those ports are available. Is there a work around for the using data pins instead? Researching myself but I thought I might query the board!

    You can use almost any of the propeller's digital I/O pins, but here are some good examples of what pins to use and how to code for this...

    For Spin:
    http://learn.parallax.com/KickStart/29133


    For C (using SimpleIDE):
    Look in the path "SimpleIDE:learn:Simple Libraries:Sensor:" for the "libcompass3d" directory...
    
    Inside that directory, you'll see:
    [LIST]
    [*]Documentation compass3d Library.html  <= open this in a web browser for documentation on this library which works with the HCM5883L
    [*]libcompass3d.c <= example code for using the HCM5883L in C
    [/LIST]How to:[LIST=1]
    [*]In SImpleIDE, open the above-mentioned file named "libcompass3d.c" in "SimpleIDE:learn:Simple Libraries:Sensor:libcompass3d:"
    [*]Select the "Set Project View" option from the "Tools" menu
    [*]Click the "Set Project to Current Tab" button, Or use the "Set Project" option from the "Project" menu, OR use the F4 key
    [*]"Save As" the new project, naming it something you will remember :-)
    [*]You should be able to compile this example!
    [/LIST]
    

    I hope this helps!

    dgately
  • Mike GreenMike Green Posts: 23,101
    edited 2013-09-16 12:02
    There is no specific I2C port on the Propeller although I/O pins 28 & 29 are used for the standard program EEPROM. I/O pins 30 & 31 are used for the serial connection to a PC. After the reset initialization is complete and a program is running, any I/O pin can be used for any sort of operation except for video where they're grouped into 4 possible VGA groups (8 pins each) and 8 possible TV groups (4 pins each).
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-09-16 12:05
    I don't see a way of accessing P28 and P29 on the Activity Board. As dgately suggests, you'll need to use one of the general purpose pins (P0 - P15). You'll want to use pull-up resistors on the I2C lines. 10K resistors pulled to 3.3V seems to be the norm with the Propeller.
  • PublisonPublison Posts: 12,366
    edited 2013-09-16 12:07
    Welcome to the forum!

    The nice thing about the Propeller is that you can any pins to any hardware output. You can use a variety of objects in the OBEX to use in SPIN, the native Propeller language, or C as dgately has shown. You can also use Pins 28 and 29 that you could share with and EEPROM.

    New questions are always welcome here.

    EDIT Dang!! I have to learn how to type faster. Mike and Duane where first, as usual. :)
    Duane..good call on the lack of access on P28.P29






  • oakguyoakguy Posts: 21
    edited 2013-09-17 15:52
    dgately wrote: »
    You can use almost any of the propeller's digital I/O pins, but here are some good examples of what pins to use and how to code for this...

    For Spin:
    http://learn.parallax.com/KickStart/29133


    For C (using SimpleIDE):
    Look in the path "SimpleIDE:learn:Simple Libraries:Sensor:" for the "libcompass3d" directory...
    
    Inside that directory, you'll see:
    [LIST]
    [*]Documentation compass3d Library.html  <= open this in a web browser for documentation on this library which works with the HCM5883L
    [*]libcompass3d.c <= example code for using the HCM5883L in C
    [/LIST]How to:[LIST=1]
    [*]In SImpleIDE, open the above-mentioned file named "libcompass3d.c" in "SimpleIDE:learn:Simple Libraries:Sensor:libcompass3d:"
    [*]Select the "Set Project View" option from the "Tools" menu
    [*]Click the "Set Project to Current Tab" button, Or use the "Set Project" option from the "Project" menu, OR use the F4 key
    [*]"Save As" the new project, naming it something you will remember :-)
    [*]You should be able to compile this example!
    [/LIST]
    

    I hope this helps!

    dgately

    Very cool and very helpful! :smile:
Sign In or Register to comment.