Announcement

Collapse
No announcement yet.

I2C communication

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • joerapoza
    replied
    How could you see that? Change to 0(zero), it works!!!!

    Thanks very much.

    Joe Rapoza

    Leave a comment:


  • Darrel Taylor
    replied
    You have $AO, with the letter O.
    Change it to a 0 (zero).

    Leave a comment:


  • joerapoza
    replied
    Hi Darrel,

    I put in the commas a you suggested. The 2 bytes 0x00 are to keep the clock going so the humidity sensor I am communicating with can store the info in it's own EEPROM so it can be retrieved with a I2CREAD.

    Still getting a syntax error ie Syntax error 78

    Help!

    Leave a comment:


  • Darrel Taylor
    replied
    Joe,

    You need some more commas in there.
    Code:
    I2CWRITE PORTA.1, PORTC.1, $27, $A0, [$00, $00]
    and the 2 bytes $00 are to keep the ClockPin active to receive 2 bytes of data.
    That's not going to work.
    I2CWRITE does not receive anything.
    You would need I2CREAD to receive data.

    Leave a comment:


  • joerapoza
    replied
    Originally posted by joerapoza View Post
    Thanks Darrel as always you have been a great help
    Darrel, I have run into more problems in my endeaver to code IsC commuications. ie in trying to compile I received syntax errors.. What I wrote:

    I2CWRITE PORTA.1 PORTC.1 $27, $AO, [$00, $00]

    Write, PortA.1 is SDA pin, Portc.1 is clock pin, $27 is the address of the device I'm writing to, AO is the command to set the device in command mode, and the 2 bytes $00 are to keep the ClockPin active to receive 2 bytes of data.

    The errors are in syntax (compiler response)

    Joe Rapoza

    Leave a comment:


  • joerapoza
    replied
    Thanks Darrel as always you have been a great help

    Leave a comment:


  • Darrel Taylor
    replied
    Hi Joe,

    The I2CREAD/I2CWRITE commands handle all the start/stop/ack bit's.
    You don't need to do it manually.

    Leave a comment:


  • joerapoza
    started a topic I2C communication

    I2C communication

    I'm using a PIC 16F616. I need to communicate with an I2C device (humidity sensor). How do I initiate a I2C start? or Stop? Does the processor do this autmatically?

    Does anyone have example code?

    Joe Rapoza
Working...
X