This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DAC081C081: DAC081C081

Part Number: DAC081C081
Other Parts Discussed in Thread: ADS1015, , ADS1115

HI,   i have bus i2c whith DAC081C081 and ADS1015  the  DAC081C081 have address D (hex) and ADS1015 have 49 (HEX) , The master is micro-pc linux whit s.o OpenWrt.

THE PROBLEM :

If i  write on DAC081C081 register i have not problem (exsample if write value FF (hex)  i have in VOUT 3.3v), but after i read the ADS1015(i  read the right value from ads1015) the VOUT of DAC081C081 go down  to 0,109 V ?????  and   after  if  read the  value of  register of DAC081C081  the value is changed ???

FABRIZIO

  • Hi Fabrizio,

    Welcome to E2E and thank you for your query. Could you please recheck the slave address of ADS1015? Because there is a possibility that it may clash with the broadcast address of the DAC. I just want to make sure that is not the reason.

    Could you please also send a scope capture of the waveforms?

    Regards,
    Uttam Sahu
    Applications Engineer, Precision DACs
  • Hi recheked slade ID od ADC (0x49)and not is bloardcast address of DAC ( it is 0x48).

    Now i can't send waveform, if you want can send source code use for read and write on ADC and DAC.

    Fabrizio

  • you need source code?

  • Please send.

    Regards,
    Uttam
  • void dac0815(){

    int ADS_address = 0xD; // Address of our device on the I2C bus
    int I2CFile;
    unsigned char writeBuf[2]; // Buffer to store the 3 bytes that we write to the I2C device
    unsigned char readBuf[2]; // 2 byte buffer to store the data read from the I2C device

    int16_t val; // Stores the 16 bit value of our ADC conversion

    I2CFile = open("/dev/i2c-0", O_RDWR); // Open the I2C device

    ioctl(I2CFile, I2C_SLAVE, ADS_address); // Specify the address of the I2C Slave to communicate with

    writeBuf[0] = 0x30; // This sets the 8 MSBs of the config register (bits 15-8) to 11000011
    writeBuf[1] = 0x00; // This sets the 8 LSBs of the config register (bits 7-0) to 10000011

    write(I2CFile, writeBuf, 2);

    readBuf[0]= 0;
    readBuf[1]= 0;

    usleep(20000);
    read(I2CFile, readBuf, 2); // Read the contents of the conversion register into readBuf
    printf("DAC 0 : %d %d \n ",readBuf[0],readBuf[1]);

    close(I2CFile);


    }


    void dac08256(){


    int ADS_address = 0xD; // Address of our device on the I2C bus
    int I2CFile;
    unsigned char writeBuf[2]; // Buffer to store the 3 bytes that we write to the I2C device
    unsigned char readBuf[2]; // 2 byte buffer to store the data read from the I2C device

    int16_t val; // Stores the 16 bit value of our ADC conversion

    I2CFile = open("/dev/i2c-0", O_RDWR); // Open the I2C device

    ioctl(I2CFile, I2C_SLAVE, ADS_address); // Specify the address of the I2C Slave to communicate with

    writeBuf[0] = 0x3F; // This sets the 8 MSBs of the config register (bits 15-8) to 00011111
    writeBuf[1] = 0xFF; // This sets the 8 LSBs of the config register (bits 7-0) to 11111111


    // Write writeBuf to the ADS1115, the 3 specifies the number of bytes we are writing,
    // this begins a single conversion
    write(I2CFile, writeBuf, 2);

    // Initialize the buffer used to read data from the ADS1115 to 0
    readBuf[0]= 0;
    readBuf[1]= 0;

    usleep(20000);
    read(I2CFile, readBuf, 2); // Read the contents of the conversion register into readBuf
    printf("DAC FF : %d %d \n ",readBuf[0],readBuf[1]);

    close(I2CFile);
    }


    void analogin(){


    int ADS_address = 0xD; // Address of our device on the I2C bus
    int I2CFile;
    unsigned char writeBuf[3]; // Buffer to store the 3 bytes that we write to the I2C device
    unsigned char readBuf[2]; // 2 byte buffer to store the data read from the I2C device

    int16_t val; // Stores the 16 bit value of our ADC conversion

    I2CFile = open("/dev/i2c-0", O_RDWR); // Open the I2C device

    ioctl(I2CFile, I2C_SLAVE, ADS_address); // Specify the address of the I2C Slave to communicate with

    // These three bytes are written to the ADS1115 to set the config register and start a conversion
    writeBuf[0] = 1; // This sets the pointer register so that the following two bytes write to the config register

    writeBuf[1] = 0x44; // This sets the 8 MSBs of the config register (bits 15-8) to 11000011
    writeBuf[2] = 0x83; // This sets the 8 LSBs of the config register (bits 7-0) to 10000011


    // Write writeBuf to the ADS1115, the 3 specifies the number of bytes we are writing,
    // this begins a single conversion
    write(I2CFile, writeBuf, 3);

    // Initialize the buffer used to read data from the ADS1115 to 0
    readBuf[0]= 0;
    readBuf[1]= 0;

    writeBuf[0] = 0; // Set pointer register to 0 to read from the conversion register
    write(I2CFile, writeBuf, 1);
    usleep(20000);
    read(I2CFile, readBuf, 2); // Read the contents of the conversion register into readBuf
    // printf("web analog value: %d %d \n ",readBuf[0],readBuf[1]);
    val = readBuf[0] << 8 | readBuf[1]; // Combine the two bytes of readBuf into a single 16 bit result
    printf("ADC value: %d ",val);
    printf(" Voltage Reading %f (V) \n", (((float)val*0.0625 )/1000) ); // Print the result to terminal, first convert from binary value to mV

    close(I2CFile);


    }

    void main(){
    for(;;){
    //nalog_IN();
    analogin();
    sleep (2);
    dac08256();
    sleep (3);
    dac0815();
    sleep (3);
    }
    }

  • I sent source code
  • Hi Fabriazo,

    I am looking into it. Will get back to you soon.

    Regards,
    Uttam