MCP4728 (page 42) - change Address Bits 000 to 010.

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
Jan Jakubec
Posts: 4
Joined: 15 Apr 2017 15:57

MCP4728 (page 42) - change Address Bits 000 to 010.

#1 Post by Jan Jakubec » 01 Mar 2024 22:04

Hello experts,
I need to change the Address Bits of the MCP4728, but I am not experienced enough to write a program.

My program is as follows and it does not work:

// Write Command: Write I2C Address Bits to the DAC Registers and EEPROM - page 42
sbit LDAC at LATB.B2; // Pin RB2
LDAC = 1;
I2C1_Start();
I2C1_Wr(0b11000000);
I2C1_Wr(0b01100001);
LDAC = 0;
I2C1_Wr(0b01101010);
I2C1_Wr(0b01101011);
I2C1_Stop();

Could someone fix it.

Thank you very much.
Jan Jakubec

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: MCP4728 (page 42) - change Address Bits 000 to 010.

#2 Post by IvanJeremic » 17 Mar 2024 19:52

Hi,

If you want to use I2C1_wr you need to initialize the I2C first.
https://download.mikroe.com/documents/c ... tm#i2c1_wr

Regards,

Ivan.

Jan Jakubec
Posts: 4
Joined: 15 Apr 2017 15:57

Re: MCP4728 (page 42) - change Address Bits 000 to 010.

#3 Post by Jan Jakubec » 21 Mar 2024 21:54

Dear Ivan Jeremic.

I can initialize I2C devices.
I need advice on how to go from 1 to 0 before bit 8.

I2C1_Wr(0b0110000 /LDAC = 1; => LDAC = 0;/ 1);

Thank you very much.
Jan Jakubec

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: MCP4728 (page 42) - change Address Bits 000 to 010.

#4 Post by IvanJeremic » 24 Mar 2024 11:09

Hi,

Try going through our example for DAC 4 click, it also uses MCP4728.
https://libstock.mikroe.com/projects/vi ... ac-4-click

You can also see in the links below how to use I2C with MCP4728:
https://download.mikroe.com/documents/d ... 100,106,92
https://download.mikroe.com/documents/d ... 100,442,92

Regards,

Ivan.

Post Reply

Return to “mikroC PRO for PIC General”