Other Parts Discussed in Thread: , LDC1612, LDC1312
Hi!
Based on evaluation board LDC1614EVM I have tried to make communication between my MCU and LDC1614.
Generally I have problem to understand how set the main address of the LDC for write and read. The "addr pin" in my solution is connected to the ground so the LDC adress is set to 0x2A.
According to the datashet the serial bus address has a bit that is responsible for R/W. How I can change the adres for write or read? Below I am sending my code for read data from LDC. In this case the resposne is 0x2A and 0x2A.
TWI_start(); TWI_write(0x2A); // ADDR do GND TWI_write(0x00); TWI_start(); TWI_write(0x2A); // ADDR do GND bajt0=TWI_read(ACK); bajt1=TWI_read(ACK); TWI_stop(); uart_putint(bajt0,16); uart_puts(" "); uart_putint(bajt1,16); uart_puts("\n");
Also I am sending a configuration of the LDC:
//RCOUNT 0 TWI_start(); TWI_write(adr); // ADDR do GND TWI_write(0x08); TWI_write(0x04); TWI_write(0xD6); TWI_stop(); _delay_ms(10); //Settlecount 0 TWI_start(); TWI_write(adr); // ADDR do GND TWI_write(0x10); TWI_write(0x00); TWI_write(0x0A); TWI_stop(); _delay_ms(10); //Clock Dividers 0 TWI_start(); TWI_write(adr); // ADDR do GND TWI_write(0x14); TWI_write(0x10); TWI_write(0x02); TWI_stop(); _delay_ms(10); //Error config TWI_start(); TWI_write(adr); // ADDR do GND TWI_write(0x19); TWI_write(0x00); TWI_write(0x00); TWI_stop(); _delay_ms(10); //MUX Config TWI_start(); TWI_write(adr); // ADDR do GND TWI_write(0x1B); TWI_write(0x02); TWI_write(0x0C); TWI_stop(); _delay_ms(10); //Drive current 0 TWI_start(); TWI_write(adr); // ADDR do GND TWI_write(0x1E); TWI_write(0x90); TWI_write(0x00); TWI_stop(); _delay_ms(10); //Config TWI_start(); TWI_write(adr); // ADDR do GND TWI_write(0x1A); TWI_write(0x14); TWI_write(0x01); TWI_stop();