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.

CCS/DAC7571: Configure a DAC7571 to create a sine wave with I2C

Part Number: DAC7571
Other Parts Discussed in Thread: CC2650

Tool/software: Code Composer Studio

Hello everyone! 
It's my first try using I2C and I need to configure a DAC7571 to get in output a sine wave with 1V peak amplitude and 30Hz frequency on a cc2650 launchpad. Is there a library or some kind of code already compiled from where I can learn how to do it? 

Thank you

  • Hi Luca,

    The first step would be to get a I2C example running. You should be able to implement this which a simple timer function that can set your sample rate.

    Find an I2C example here:
    dev.ti.com/.../

    Thanks!
    Paul
  • Thanks, this surely helped, but I still don't know how to set my DAC's output voltage
    Thanks
    Luca
  • Hi Luca,

    What specifically do you not know how to do? I would break the problem into a couple of steps:
    1. Get I2C communication working on the launchpad: The code example is great starting point. You will need to ensure that you addressing the DAC correctly, then sending some sample codes to see if the DAC responds
    2. Figure out the desired sample rate you want for the sine wave. If you are targeting a 30Hz wave, then you need to consider how many point it would take to represent a sign wave with an acceptable level of distortion. Lets start with 100 samples per period, or 3ksps.
    3. Write a routine to update the DAC at 3ksps. This means you will need to get a timer that will trigger ~333µs, then issue a I2C command. There should be a lot of examples of this online.
    4. Figure out how you want to store the digital version of the sinewave in the MCU. While you may find a sin() function in a math library, I think you will find that these can be fairly intensive for the MCU. As you know that you will have a static number of points per period (100), I think you could just store an array of the 12-bit DAC codes to generate the sign wave.

    This should have you up and running!
    Thanks,
    Paul