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.

DAC5574

Other Parts Discussed in Thread: DAC5574

Hello there,

I used 2 GPIO pins to program DAC5574 but could not make it. I am using VOUTD for voltage output. I am pretty sure I2C code should work. My question is about writing correct slave address, control byte, MS-Byte, and LS-byte to DAC5574:

unsigned char Write_DAC(unsigned char voltagedata)
{
    start()                                          ;
    write1byte(0x98)                                 ; // DAC5574 slave address
    if(check())   write1byte(0x06)             ;      //  check () returns Acknowledge from DAC. if it is true,  write DAC control byte =0x06?
    else          return 0                                ;
    if(check())   write1byte(voltagedata)             ;     //write DAC MS data (any value from 0 ~ 256)
    else          return 0                           ;
    if(check())   write1byte(0xff)             ;     // write LS data (don't care, could be any value, right?)
    else          return 0                           ;
    if(check())   stop()                             ;
    else                                     ;
    return 1                                         ;
}

Please correct me if I am wrong. I appreciate it!

Fred

  • Hello Fred,

    The code looks like it follows the correct protocol, although to guarantee that the code is working it would be great if you could share a scope capture of the digital pins SCL and SDA.

    For now, I will give you some comments on a byte per byte basis:

    • The Slave address byte (0x98) is correct, assuming that the pins A0 and A1 are tied to GND.
    • The Control byte (0x06) is currently onlyloading the DAC register for channel D. The output of the DAC will not change.
      • If you would like the output of channel D to immediately update after writing to it, you need to use the byte 0x26
      • For more information take a look at Table 1 in the DAC5574 datasheet.
    • The MS byte can be any number between 0 and 255, not 256.
    • The LS byte can be any value.

    Hopefully this helped.

    Let me know if you have any other questions.

  • Thanks, Eugenio! Can I send the whole code to you for your review? I still have a problem. I appreciate it!
  • I am an analog engineer so I am not specialized in the programming side of things, but I can try to take a look at it. The best way for me to help you would be to take a look at the oscilloscope captures of the digital pins. This way I can verify that the I2C protocol is being generated correctly.
    If you would like to share any of this information privately, do you allow me to contact you directly to your E2E registered email?
  • Yes, if you can contact me to my E2E email, I would like to share my code with you. This should help me a lot. Thanks!
  • This thread has been taken offline.