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.

DAC 1220E: programming it

Other Parts Discussed in Thread: DAC1220

Hi folks. We are  trying to use DAC 1220E (20 bits). The implemented circuit is done according to reference manual. However, we are having problem to program the DAC. I would like to know if  anybody can provide us some piece of code (in C, Assembly, etc...) in a sequence to make the DAC start and work correctly.  This is an academic work at UNESP, Brazil. Thanks for any help.

  • Jozue,


    Unfortunately, I don't know of any sample code for the DAC1220. You might be able to find some with a basic google search for DAC1220 source code, but I don't know of anything available written here at TI.

    If you have some code that you're working on, I might be able to help if you're able to post the code, along with any output from an oscilloscope (or logic analyzer) to verify your code is correctly communicating with the device.


    Joseph Wu
  • Thank you Joseph. My colleague wrote a code to implement in Arduino. Could you take a look on it and check whether there is something wrong? Please see below:

    ****************
    #include <SPI.h>
    #define SCLK 13

    int aux=0;
    int value0=0;
    int value1=0;
    int value2=0;
    int INSR=0;
    int T=0;
    int T2=0;

    void setup() {
    Serial.begin(115200);

    pinMode(SCLK, OUTPUT);
    digitalWrite(SCLK, LOW);
    delay(100);
    digitalWrite(SCLK, HIGH);
    delayMicroseconds(450);
    digitalWrite(SCLK, LOW);
    delayMicroseconds(10);
    digitalWrite(SCLK, HIGH);
    delayMicroseconds(250);
    digitalWrite(SCLK, LOW);
    delayMicroseconds(10);
    digitalWrite(SCLK, HIGH);
    delayMicroseconds(450);
    digitalWrite(SCLK, LOW);
    delayMicroseconds(10);
    digitalWrite(SCLK, HIGH);
    delayMicroseconds(850);
    digitalWrite(SCLK, LOW);
    delay(1000);

    SPI.begin();
    SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE1));
    delay(100);


    INSR = 64;
    value2 = 192;
    value1 = 0;
    value0 = 0;
    T=7;
    T2=230;
    SPI.transfer(INSR);
    delayMicroseconds(T);
    SPI.transfer(value2);
    delayMicroseconds(T);
    SPI.transfer(value1);
    delayMicroseconds(T);
    SPI.transfer(value0);
    delayMicroseconds(T);
    delay(T2);
    }

    void loop() {
    Serial.print(INSR);
    Serial.print(' ');
    Serial.print(value2);
    Serial.print(' ');
    Serial.print(value1);
    Serial.print(' ');
    Serial.print(value0);
    Serial.println(' ');
    }

    ******************************

    Using this code, the DAC output does not match with the input code. We supoose the DAC was not correctly initialized.

    Thanks for your attention.
  • Jozue,


    I don't see anything that would be a problem, but I'm not an expert at reading through code. It looks like you have set up the right version of SPI. Note that I would make sure that the transaction has /CS low through the entire communication, not just for each byte.

    I would post the oscilloscope of logic analyzer output to verify all the timing and the communication. It's important to know that the lines are toggling correctly.


    Joseph Wu