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 -current limited voltage output

Other Parts Discussed in Thread: DAC8760

Hi,

we are trying to do a 4-20mA transmitter using DAC8760 on reference to datasheet "SHORT-CIRCUIT CURRENT

LIMITING " page no 46. I have seen a unidirectional current limiter circuit fig 96.

can we use a op - amp in buffer stage for the voltage output instead of the Fig 96. ?.

if not please give the resistor values and transistor part no for 

Thank You

Regards Rajesh

  • Rajesh,

    Is your goal to implement a precise current limit for the voltage output stage of your design?  What is the maximum source current you want to allow? For my own curiosity, what is driving your requirement for limiting the voltage output current drive strength to a precise value?

    You can certainly add an op amp in the voltage output signal chain but I'm not sure how effective that will be at providing a precise current limit since maximum current drive strength is not usually a trimmed parameter - so there will be some deviation from part to part. If your goal is simply to add / subtract current drive to the circuit, without any precision requirement, then adding an amplifier will certainly help you achieve that. In order to preserve performance of the voltage output you should look for amplifiers with low input offset voltage and comparable slew-rate.

    Selecting resistor values for the circuit shown in Figure 96 depends on the precision current limit you would like to establish. Transistor selection should follow the selection of the current limit / resistor values.

  • hi  sir ,

    this our code which is used for write into DAC, the code was working if the crcEN bit was turned off.

    we want to implement the Code with crc enable.

    step 1: put latch pin low

    step 2: write the address byte

    step 3: write the data byte(High)

    step 4: write the data byte(Low)

    step 4:

    calculate crc :>

    crcReg =0x00;

    crcReg =CRC8(, unsigned char crcReg,address byte)

    crcReg =CRC8(, unsigned char crcReg,data byte High )

    crcReg =CRC8(, unsigned char crcReg,data byte LOW)

    write  the crc value to dac.

    step 6: put latch pin high and low

    end.

    the crc calculation code

    unsigned char CRC8(unsigned char crcData, unsigned char crcReg)
    {
    unsigned char i;
    for(i = 0; i < 8; i++)
    {
    if((crcReg & 0x80) ^ (crcData & 0x80))
    {
    crcReg = ( (crcReg << 1) ^ CRC8_POLY);
    }
    else
    {
    crcReg = (crcReg << 1);
    }

    similarly the read code has written as :


    }
    else
    {
    crcReg = (crcReg << 1);
    }
    crcData <<= 1;
    }
    return crcReg;
    }

    The dac returns CRC error, after reads form DAC 8760.

    step 1: put latch pin low

    step 2: write the address byte

    step 3: write the data byte as 0x00

    step 4: write the data byte(Dac register)

    step 4:

    calculate crc :>

    crcReg =0x00;

    crcReg =CRC8(, unsigned char crcReg,address byte)

    crcReg =CRC8(, unsigned char crcReg,data byte High )

    crcReg =CRC8(, unsigned char crcReg,data byte LOW)

    write  the crc value to dac.

    step 6: put latch pin high and low

    step 7: read dac for 8 clock Cycles , waste clock,

    step 8: read Msb byte  of data from DAC.

    step 9:read Msb byte of data from DAC.

    step 10: read crc byte

    step 11: put latch high and low.

    end.

    i don't where i'am going wrong kindly give a solution for this problem

    thanks and regards

    Rajesh

  • Rajesh,

    As a first simple debugging step, could you provide me with an example of a 24-bit SPI word you're writing to the DAC and the corresponding CRC word that your code generates? This will help immediately identify if your code is computing the CRC correctly.

  • hi sir ,
    here i had given my code for 24Bit spi code for DAC 8760. for read and write operations to the DAC.


    void DAC8760write(unsigned char address , unsigned int data)
    {
    DAC_8760_LATCH = LOW;
    SpiWrite( address );
    SpiWrite( (data >> 8) & 0x00FF);
    SpiWrite( (data) & 0x00FF);
    DAC_8760_LATCH = HIGH;
    NOP();
    NOP();
    DAC_8760_LATCH = LOW;
    }


    unsigned int DAC8760read(unsigned char dacRegister)
    {
    unsigned int value; // local
    DAC_8760_LATCH = LOW;
    SpiWrite( DAC8760_ADD_READ_REG ); // write addaress first
    SpiWrite( 0x00 ); // no operation
    SpiWrite( dacRegister ); // select regiater
    DAC_8760_LATCH = HIGH;
    NOP();
    NOP();
    NOP();
    DAC_8760_LATCH = LOW;
    spiread(); // no operation waste clock
    value = spiread(); // msb data
    value <<=8; // move msb
    value|= spiread(); // lsb data or with previous
    DAC_8760_LATCH = HIGH;
    NOP();
    NOP();
    NOP();
    DAC_8760_LATCH = LOW;
    return value;
    }


    i had calculated the crc calculation for write operation..like wise i had done the Read operation


    /*CRC calculation for write operation*/

    #define CRC8_POLY 0x07

    #define CRC_INIT 0x0000


    void DAC8760write(unsigned char address , unsigned int data)
    {
    unsigned char crcval= CRC_INIT;
    DAC_8760_LATCH = LOW;
    SpiWrite( address );
    crcval =calCRC8(crcval ,address);

    SpiWrite( (data >> 8) & 0x00FF);
    crcval =calCRC8(crcval ,( (data >> 8) & 0x00FF));
    SpiWrite( (data) & 0x00FF);
    crcval =calCRC8(crcval ,( (data) & 0x00FF));

    SpiWrite( (crcval) & 0x00FF);
    DAC_8760_LATCH = HIGH;
    NOP();
    NOP();
    DAC_8760_LATCH = LOW;
    }

    /**
    *
    CRC calculation code for HEC ATM 8 bit.





    unsigned char calCRC8(unsigned char crcData, unsigned char crcReg)
    {
    unsigned char i;
    for(i = 0; i < 8; i++)
    {
    if((crcReg & 0x80) ^ (crcData & 0x80))
    {
    crcReg = ( (crcReg << 1) ^ CRC8_POLY);
    }
    else
    {
    crcReg = (crcReg << 1);
    }
    crcData <<= 1;
    }
    return crcReg;
    }


    thanks and regards
    Rajesh
  • Rajesh,

    As I mentioned before, it would be easiest to debug if you could give me an example 24-bit SPI word you're writing to the DAC and the corresponding CRC word that your code generates to debug this issue rather than stepping through your code.
  • hi sir ,

    here i had given the 24 bit spi written to the DAC8760 and crc value can be seen below image...

    byte 1: 0x55

    byte 2: 0x90

    byte 3: 0x00

    three bytes of data written to the dac and crc crc value = 0x05.

    dac8760.c
    #define CRC16_POLY 0x10003
    #define CRC8_POLY  0x07
    
    #define CRC_INIT   0x0000
    
    
    unsigned char calCRC8(unsigned char crcData, unsigned char crcReg)
    {
    unsigned char i;
        for(i = 0; i < 8; i++)
        {
            if((crcReg & 0x80) ^ (crcData & 0x80))
            {
                crcReg = ( (crcReg << 1) ^ CRC8_POLY);
            }
            else
            {
                crcReg = (crcReg << 1);
            }
            crcData <<= 1;
        }
        return crcReg;
    }
    
    
    
    
    void DAC8760write(unsigned char address , unsigned int data)
    {
       /*
     	DAC_8760_LATCH          = LOW;
        SpiWrite( address );
    	*/
        unsigned crcval = CRC_INIT;
    	crcval =    calCRC8(crcval,address);
        printf("the address byte =%x\n",address);
        
       // SpiWrite( (data >> 8)   &   0x00FF);
        
        crcval =    calCRC8(crcval,( (data >> 8)   &   0x00FF));
        printf("the high byte data =%x\n",( (data >> 8)   &   0x00FF));
        
        //SpiWrite( (data)   &   0x00FF);
        crcval =    calCRC8(crcval,( (data)   &   0x00FF));
        printf("the low byte data=%x\n",( (data)   &   0x00FF));
        
        //SpiWrite( (crcval)   &   0x00FF);
        printf("the crc byte data=%x\n",( (crcval)   &   0x00FF));
        
    /*
        
        DAC_8760_LATCH          = HIGH;
        NOP();
        NOP();
        DAC_8760_LATCH          = LOW;
    	*/
    }
    
    
    
    
    
    
    
    int main()
    {
    	//printf("the valuie = %x \n", (DAC8760_CONTROL_RANGE_0_TO_5  | DAC8760_CONTROL_REG_CLEAR | DAC8760_CONTROL_REG_OUTEN));
    	
    	
    	DAC8760write(0x55,0x9000);
    	
    }
    
    
    
    
    
    

  • Rajesh,

    The CRC word is correct.

    Can you show an oscilloscope capture of the word being written to the SPI bus so I can check clock phase and polarity settings and overall integrity?

  • Hi sir,

    i had first programmed the controller to vary the dac Volatage without CRC enabled in config register , then i reprogrammed the controller with crc enabled ,

    now i got CRC error when i read status register.

    After all i had reset (power ON Reset) the device totally , then it has worked...

    Thanks for your help sir..

    thanks and regards 

    Rajesh