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.

Dude about code for DAC7750 with the same electrical schematic on page 38 of the data sheet.

 Hello support/comunity

I make a board with the example  electrical schema  8.2.1 (Analog output Module for PLC-and DCS Based Industrial -Control Systems) page 38 the only difference between this one an the one that I make is a pull down resistor on pin 7 on the ISO7631 that control the enable of SDO communication pin because we have another device on this bus, so here is dude my partner Nicolas is working with the code and make the following code cited below.

The code write 0x00FF, and the DAC answer with high level for an short period on the SDO pin without any clock and then return 0x00F0, the current output still in 0.

Could you please help us to find what is wrong here, in this code or show us an example if you have it?

 

Thanks in advance

 

 

PHY_INA = 0; // TO CLEAR

    PHY_INB = 0; // TO LATCH
 
    fdac_write((uint8_t)DAC_WRITE_DAC,(uint16_t)0x00FF);
    toReturn = fdac_read((uint8_t)DAC_RD_DAC); 

#define DAC_NOP         0x00
#define DAC_WRITE_DAC   0x01
#define DAC_READ        0x02
#define DAC_WRITE_CTRL  0x55
#define DAC_WRITE_RST   0x56
#define DAC_WRITE_CFG   0x57
#define DAC_WRITE_GAIN  0x58
#define DAC_WRITE_ZERO  0x59
#define DAC_WTDG_RST    0x95
#define DAC_RD_STATUS   0x00
#define DAC_RD_DAC      0x01
#define DAC_RD_CTRL     0x02
#define DAC_RD_CFG      0x0B
#define DAC_RD_GAIN     0x13
#define DAC_RD_ZERO     0x17

//For write the DAC

void fdac_write(uint8_t address, uint16_t value)
{
    volatile uint8_t tmpRFIE = RFIE;
    uint8_t aux;
    uint16_t toReturn;
    RFIE = 0;
    PHY_INB = 0; // TO LATCH 
    PHY_CS2 = 1; // ISO7631 ENABLE 
    SPIPut(address);
    SPIPut(value >> 8);
    SPIPut(value);
    PHY_INB = 1;
    NOP();
    NOP();
    PHY_INB = 0;
    PHY_CS2 = 0;
    RFIE = tmpRFIE;
}
//for read the DAC
uint16_t fdac_read(uint8_t address)
{
    volatile uint8_t tmpRFIE = RFIE;
    uint8_t aux;
    uint16_t toReturn;
    
    RFIE = 0;
    PHY_INB = 0;
    PHY_CS2 = 1;
    SPIPut((uint8_t)DAC_READ);
    SPIPut(0x00);
    SPIPut(address);
    
    PHY_INB = 1;
    NOP();NOP();NOP();NOP();
    PHY_INB = 0;
    aux = SPIGet();
    aux = SPIGet();
    toReturn = aux << 8;
    aux = SPIGet();
    toReturn = toReturn + aux;
    PHY_INB = 1;
    NOP();
    NOP();
    PHY_INB = 0;
    PHY_CS2 = 0;    
    RFIE = tmpRFIE;
    return toReturn;
}