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.

基于MSP430的AD9851驱动



#include"msp430x14x.h"
#include"ad9851.h"

void delay();
/**************************************************
函数名称:Write_Parrel_AD9851()
函数作用:向端口D0~D7(P3OUT)送入40位(W0~W4)控制字
函数说明:W0控制6倍频  Frequence为频率值
返回值  :无
***************************************************/
void Write_Parrel_ad9851(long int Frequence)
{  
    _DINT();
    Init_ad9851();
    unsigned long int Y;
    Frequence=Frequence*266;
    Y = Frequence/10;
    unsigned char i,temp;
    for(i=0;i<32;i++)
      { temp=Y&0x01;
        W_CLK_L;
        if(temp)   //测试点

          {D_OUT_H}
        else
          {D_OUT_L}
        delay();
        W_CLK_H;
         delay();
      
        Y>>=1;
        
      }
    for(i=0;i<8;i++)
      {
      
        delay();
        W_CLK_L;
       
        if(i==0)//测试点

         {D_OUT_H;}
        else
         D_OUT_L;
         delay();
         W_CLK_H;
         delay();
        
      }

 
      W_CLK_L;
      delay();
      FQ_UD_H;
      delay();
      FQ_UD_L;
      _EINT();
}