I2C library with the PIC18F46K22 and MCP4728

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
Goblin039
Posts: 1
Joined: 07 May 2022 11:07

I2C library with the PIC18F46K22 and MCP4728

#1 Post by Goblin039 » 07 May 2022 12:48

Hello, I am trying to use I2C library with the PIC18F46K22 and MCP4728, but it isn't work
I need to use Multi-Write Command.


I2C2_Init(100000) ;
I2C2_Start() ; // Start returns 0, no error
I2C2_Wr(0xC0) ; // Send Address, returns 2 - error
I2C2_Wr(0x50) ; // Send Command Multi-Write, chanell A, update out, returns 2 - error
I2C2_Wr(0x0F) ; // Send Command + Data, returns 2 - error
I2C2_Wr(0x00) ; // Send Data, returns 2 - error
I2C2_Stop() ;

What is my mistake?

With best regards, Goblin

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: I2C library with the PIC18F46K22 and MCP4728

#2 Post by filip » 10 May 2022 09:12

Hi,

You can see how we implemented the communication between MCP4728 and MCU here :
https://libstock.mikroe.com/projects/view/4147

Regards,
Filip.

Post Reply

Return to “mikroC PRO for PIC General”