I2C with a PIC10F222 - is it possible


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2006
    Posts
    70

    Default I2C with a PIC10F222 - is it possible

    I've been trying to implement I2C communication with a PIC10F222 and an EEPROM with no success. I've reached the end of my mental resources (it was a short trip), and hope that someone in picforumland will help. I have the device working in terms of inputs and outputs (blinky and button response programs are OK). But when I try to do I2CWRITE and I2CREAD I get nothing. I tried using MPLAB SIM only to learn that it cannot display I2C commands at all (not with the two PICs I tried anyway). So then I hooked up a logic analyzer and was able to visualize I2C with a PIC16F688, but there was just a flatline with the PIC10F222.

    So, are PICBASIC I2C commands possible with this PIC? If not is there some possibility of implementing a rudimentary I2C subroutine in PICBASIC (If only I could do assembly...)

    I know I should just choose another PIC, but I really want to use that tiny SOT23 package.

    Thanks for any help...

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I have not used those little buggers but it should work with a little code change
    From the manual
    For 12-bit core PICmicro MCUs only, the I2C clock and data pins are fixed at compile time by DEFINEs. They still must be specified in the I2CREAD statements, though this information is ignored by the compiler.

    DEFINE I2C_SCL PORTA,1 'For 12-bit core only
    DEFINE I2C_SDA PORTA,0 'For 12-bit core only
    The upper 7 bits of the Control byte contain the control code along with chip select or additional address information, depending on the particular device. The low order bit is an internal flag indicating whether it is a read or write command and should be kept clear.
    and this may also help
    http://melabs.com/support/12-bit.htm
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Nov 2006
    Posts
    70


    Did you find this post helpful? Yes | No

    Default Code explosion

    Thanks Dave. I think that may have been the problem. Unfortunately, when I added those line (using GPIO instead of PORTA) the size of the compiled program increased quite a bit. Too much for me to do what I want to do. So I am back to the drawing board now. I have to come up with a new programming strategy if I am going to get the job done with just 512 words.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Can you post your code?
    Maybe someone will be able to see a way to optimize it.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. Another I2C Slave Routine Problem
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2009, 05:50
  4. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  5. Please help with i2cslave i2c slave
    By cycle_girl in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st December 2005, 13:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts