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 8760 not working??

I am currently working on TI 8760 but I didn't get output.Here I write  the source code.

//#include<pic.h>
#include<p30fxxxx.h>


_FOSC(HS & CSW_FSCM_OFF);           /*    external clock source , clock switching and fail safe monitoring disable    */
_FWDT(WDT_OFF);                     /*    watchdog timer off     */
_FBORPOR(PBOR_ON & BORV_27 & PWRT_64  & MCLR_EN); /*    enable the Brown-out Reset circuit    */


#define FOSC 16000000L // crystal frequency - 16MHz
#define FCY (FOSC/4)  //instruction cycle clock freq.
#define WAIT_1uSEC()    asm("nop");asm("nop");asm("nop");asm("nop");


    


#define SD_SDI        LATBbits.LATB0//LATBbits.LATB4//

#define SD_SCK        LATBbits.LATB1//LATBbits.LATB2//
#define LATCH        LATBbits.LATB2//LATBbits.LATB5//





#define SET 1
#define CLEAR 0

//for ti8760
#define TI8760_CONTROLBITS 0x00553005
#define TI8760_ADDRESSBITS 0x00010000


#define LONG unsigned long int
#define INT8 unsigned char

void delay()
{
    unsigned int i;
    for(i=0;i<65534;i++)
    {    
        ;
    }

}




 
 void write_8760(unsigned long int data)
 {
 unsigned char i;

     LATCH=CLEAR;
      SD_SCK=CLEAR;
     for(i=0;i<24;i++)
         {
             SD_SCK=CLEAR;
             if((data&0x800000)==1)
                 SD_SDI=SET;
             else
                 SD_SDI=CLEAR;
         
         asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop");        
                 SD_SCK=SET;
                 data<<=1;
         asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop");
        asm("nop"); asm("nop"); asm("nop"); asm("nop");            
         
         }
             SD_SCK=CLEAR;
       asm("nop"); asm("nop"); asm("nop"); asm("nop");
    asm("nop"); asm("nop"); asm("nop"); asm("nop");
    asm("nop"); asm("nop"); asm("nop"); asm("nop");
    asm("nop"); asm("nop"); asm("nop"); asm("nop");  
    LATCH = 1;
    asm("nop"); asm("nop"); asm("nop"); asm("nop");
    asm("nop"); asm("nop"); asm("nop"); asm("nop");
    asm("nop"); asm("nop"); asm("nop"); asm("nop");
    asm("nop"); asm("nop"); asm("nop"); asm("nop");  
    //LATCH = 0;
    SD_SDI = 0;
    SD_SCK = 0;
 }
 
 
 void write_8760_data( unsigned long int data)
 {
 unsigned long int dd;
dd = (data | TI8760_ADDRESSBITS);
    
 
 write_8760(dd);
 
 
 
 }
 







void init_8760()
{

LONG temp;
temp = TI8760_CONTROLBITS;
write_8760( temp) ;

}
void uc_init()
{

ADPCFG=0xFFFF;
TRISB = 0x0000;

TRISD=0x00;
TRISF = 0x0000;

}




int main()
{
unsigned  int data_ad=0,i;
unsigned long int data_t=0xffff;


 uc_init();
 
 delay();delay();

 init_8760();

 delay();delay();
 

while(1)
{

 i=1;

  write_8760_data(data_t);
delay();delay();delay();
delay();delay();delay();
delay();delay();delay();
delay();delay();delay();
i=4;
}

return 0;

}