Problem with I2C

Beta Testing discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
loojade
Posts: 35
Joined: 04 Oct 2008 03:03

Problem with I2C

#1 Post by loojade » 07 Sep 2012 13:54

Hello everybody,

I'm developing a system who need to save some datas on external eeprom by I2C protocol and at the same time use the UART to comunicate to PC (by alternate pin). I'm using dsPIC30F4012 and EEPROM 24LC1025.

1° question is: Can I use UART and I2C at same time?
2° question is (if the 1° question was "YES"): why my program stop after when I try to write via I2C? The code is the following:

Code: Select all


 dim address_H, address_L as byte
 dim data_to_eeprom as byte

  I2C1_Init(400000)      ' initialize I2C communication
  I2C1_Start()           ' issue I2C start signal
  I2C1_Write(0xA0)       ' send byte via I2C  (device address + W)
  I2C1_Write(address_H)          ' send byte (address of EEPROM location)
  I2C1_Write(address_L)          ' send byte (address of EEPROM location)
  I2C1_Write(data_to_eeprom)       ' send data (data to be written)
  I2C1_Stop()            ' issue I2C stop signal




I'm using the Timer3 to create a wave (so I can cheek the stability of system by a oscilloscope). When the program arrive to the line "I2C1_Write(0xA0) " he stop.

Anyone can help

Really thanks


Diego

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: Problem with I2C

#2 Post by janko.kaljevic » 10 Sep 2012 12:39

Hello,

I believe that I have answered you here:
http://www.mikroe.com/forum/viewtopic.php?f=111&t=50370

Best regards.

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 Beta Testing”