新闻中心

EEPW首页>嵌入式系统>设计应用> AD9850驱动程序(串行驱动)

AD9850驱动程序(串行驱动)

作者: 时间:2016-11-28 来源:网络 收藏


#include
#include "intrins.h"
#define uchar unsigned char
#define uint unsigned int

本文引用地址://m.amcfsurvey.com/article/201611/322946.htm

sbit W_CLK= P1^0;
sbit PQ_UD= P1^1;
//sbit RET= P1^2;

uchar word[5]={0x00,0x00,0x00,0x00,0x00};
unsigned long int k=42.94967296*400;//15000000就是所要输出的频率值,//若晶振不同为其他频率更改数值就行了

void chang(unsigned long int t)
{
word[1]=k>>24;
word[2]=k>>16;
word[3]=k>>8;
word[4]=k;
}

delay_1ms(uint t)
{
uint i,j;
for(i=0;i for(j=0;j<120;j++);
}

main()
{
uint i;
//RET=1;
delay_1ms(100);
W_CLK=0;
PQ_UD=0;
// RET=0;
chang(k);
while(1)
{

for(i=0;i<5;i++)
{
P0=word[i];
W_CLK=1;_nop_();
W_CLK=0;_nop_();
}
PQ_UD=1;_nop_();
PQ_UD=0;_nop_();
}
}



评论


技术专区

关闭