I2C Communication through pic18f26k83 to slave mcp4725.

I2C Communication through pic18f26k83 to slave mcp4725.

Postby Akhil » Mon Oct 25, 2021 6:37 am

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,
Attachments
i2c_22_10.zip
Project
(63.17 KiB) Downloaded 154 times
Last edited by Akhil on Mon Oct 25, 2021 6:51 am, edited 1 time in total.
Akhil
 
Posts: 2
Joined: Mon Oct 25, 2021 6:05 am
PIC experience: Professional 1+ years with MCHP products

Re: I2C Communication through pic18f26k83 to slave mcp4725.

Postby Akhil » Mon Oct 25, 2021 6:47 am

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?
Attachments
after_i2c_write_registerstatus.zip
Register values after
(134.52 KiB) Downloaded 143 times
before_i2c_write_registerstatus.zip
Register values before
(131.22 KiB) Downloaded 131 times
Akhil
 
Posts: 2
Joined: Mon Oct 25, 2021 6:05 am
PIC experience: Professional 1+ years with MCHP products


Return to SSP (IIC, SPI)

Who is online

Users browsing this forum: No registered users and 9 guests

cron