Page 1 of 1

I2C Communication through pic18f26k83 to slave mcp4725.

PostPosted: Mon Oct 25, 2021 6:37 am
by Akhil
Hi,
I am using PIC18F26K83, and trying to communicate with the slave device mcp4725. I added the I2C component and generated the code for it using MCC and calling write function of "i2c2_master_example" :

I2C2_Write2ByteRegister(my_address,my_reg,my_data);
my_address 0x60; my_reg 0x40; my_data 0xFF

OR

I2C2_WriteNBytes(my_address,my_array,3);
my_array[3]={0x40,0x50,0x70};



The code is not showing any error, but I2C is not writing and the status is "fail".


PFA project.

Regards,

Re: I2C Communication through pic18f26k83 to slave mcp4725.

PostPosted: Mon Oct 25, 2021 6:47 am
by Akhil
Hi,

PFA of the register values.

I2C2STAT0
Before I2C_Write : 0x00
After I2C_Write : 0x80
I2C2STAT1
Before : 0x20
After 1st byte :0x00
===> From data sheet:
bit 5 TXBE: Transmit Buffer Empty Status bit 1 = I2CTXB is empty (Cleared by writing the I2CTXB register) 0 = I2CTXB is full

But no value is present in I2C2TXB and I2C2CNT is not decremented.
I am not able to understand why?