微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 调试AD7799遇到的问题

调试AD7799遇到的问题

时间:12-01 来源:互联网 点击:

voidWriteAD5439(uintContralBits,uintDAdata)
{
unsignedchari;
uintbuf;
uintwave_data;
buf=DAdata;
buf=(buf<2);
wave_data=(ContralBits|buf);
SYNC_SET();
delay(1);
SCLK_SET();
SYNC_CLR();
for(i=0;i<16;i++)
{
SCLK_SET();
if((wave_data&0x8000)!=0)
{SDIN_SET();}
else
{SDIN_CLR();}
delay(1);
SCLK_CLR();
delay(1);
wave_data=(wave_data<1);
}
SYNC_CLR();
//LDAC_CLR();
//delay(1);
SCLK_SET();
//LDAC_SET();
delay(1);
}

unsignedintreadSDO(void)
{
unsignedchari=0;
unsignedintreadData=0;
bititemp;

WriteAD5439_CMD(0X2000);
SYNC_SET();
delay(1);
SYNC_CLR();

for(i=0;i<16;i++)
{
SCLK_SET();
readData<=1;
delay(1);
itemp=P0_5;
SCLK_CLR();
if(itemp)
readData|=1;
delay(1);
}
SYNC_CLR();
returnreadData;
}

voidInitAD5439(void)
{
DACLR_CLR();
delay(5);
DACLR_SET();
}

voidmain(void)
{
num=1023;
//InitAD5439();
WriteAD5439_CMD(0x9000);
WriteAD5439(0x1000,num);
//readSDO();
while(1)
{
num=1023;
WriteAD5439(0x1000,num);
delay(10);
num=0;
WriteAD5439(0x1000,num);
delay(10);
};
}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top