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.

DAC8760 - no output

Other Parts Discussed in Thread: DAC8760

Hi,

I'm using DAC8760, and configured it for 4 - 20mA. I've connected 2k and 10 k potentiometers in REFIN and REFOUT respectively. voltage @ REFOUT is 0V. then I disconnected potentiometers from REFIN and REFOUT and connected them to ground thru a capacitor. I've monitored DIN, SCK and LATCH signals on DSO and seems to be OK.

below is the schematic and code, Please guide me, where I'm doing wrong,

#define DAC_CONTROLBITS 0x00553005

#define DAC_ADDRESSBITS 0x00010000

#define DAC_RESETBITS 0x00560001

void Write_Analog_Output( unsigned long int data)
{

    LONG utemp;

    unsigned int temp, t1;  

    INT8 j, k, temp1, l;

    utemp = data;

    temp = (unsigned int) utemp;

    temp1 = (utemp >> 16);

    SD_SDI = 0;

    SD_SCK = 0;

    for(j = 0; j < 24; j++)
    {            

         SD_SCK = 1;    

         if(j < 8)
         {
             t1 = temp1;
             t1 = (t1 >> (7 - j));
         }

         else
         {
             t1 = temp;
             t1 = (t1 >> (15 - l));
             l++;
         }               
   
         if(t1 & 0x0001)
             SD_SDI = 1;
         else
             SD_SDI = 0; 

         for(k = 0; k < 20; k++);

         SD_SCK = 0;

         for(k = 0; k < 20; k++);
     }
     SD_SCK = 0;
     SD_SDI = 0;
   
     LATCH = 1;
     for(k = 0; k < 30; k++);
     LATCH = 0;
}

void Write_DAC(  unsigned long int data)
{
     data = (data | DAC_ADDRESSBITS);
     Write_Analog_Output( data);
}

void Init_DAC()
{
     LONG temp;
	 
     temp = DAC_CONTROLBITS;
     Write_Analog_Output( temp);
}

int main()
{

     delay();
     uc_init();

     Write_Analog_Output( DAC_RESETBITS);

     delay();

     Init_DAC();

     while(1)
     {
        Write_DAC(0xffff);
        delay();delay();
     }

}

  • Hi anjali,


    the DAC8760 clocks in data to its shift register on the rising edge of SCK.

    Your code looks like it clocks data on the falling edge of SCK.

    The local variable "l" you use to shift data isn't initialized (didn't your compiler warn you?).

    Doesn't your MCU have a hardware SPI interface? This would probably make things a lot easier. Also, I'd suggest, to clean up your code a bit. Why do you do this discrimination for the first 8 bit, for example?

  • Thanks for reply Arwed,

    Sorry it's copy-paste mistake but actual code is

       l = 0;

    for(j = 0; j < 24; j++)
        {           
             for(k = 0; k < 20; k++);
             if(j < 8)
             {
                 t1 = temp1;
                 t1 = (t1 >> (7 - j));
             }
             else
             {
                 t1 = temp;
                 t1 = (t1 >> (15 - l));
                 l++;
             }              
       
             if(t1 & 0x0001)
                 SD_SDI = 1;
             else
                 SD_SDI = 0;
             SD_SCK = 1;   
             for(k = 0; k < 20; k++);
             SD_SCK = 0;
             
         } 

    I'm using dspic30f3011, it has inbuilt SPI but I'm using those pins for other purpose, so implemented bit-banging. First 8 bits are MSBs 23...16. MCU is 16 bit, so it takes more instruction cycles for Long integer shifting and Clock ON - OFF time varies. So transmitted MSBs 8 bits and then 16 bits. 


    REFIN and REFout shows 5V but output current is 0mA.

  • If CAP1 CAP@ pins are NC, will it give output current?

  • Anjali,

    Thank you for patiently waiting for a response during the US holiday.

    anjali shelke said:
    I've connected 2k and 10 k potentiometers in REFIN and REFOUT respectively.

    What is the goal of including these potentiometers?

    anjali shelke said:
    voltage @ REFOUT is 0V.

    Why is REFOUT 0V? Are the potetiometers pulling the reference voltage to ground? A reference voltage (5V) needs to be provided, either from the internal reference or by an external source, for the output to function as intended.

    Are you using the external current setting resistor? If so, what is the value of R9?

  • Anjali,

    Any update to this thread?