资源简介
不错的AD7705的C语言程序,可以对数据采集并进行转换,程序简单易懂,容易理解
代码片段和文件信息
#include
#define uchar unsigned char
#define uint unsigned int
extern void lcd_init();
extern void write_shuzi(unsigned char xunsigned char yunsigned int num);
sbit clk=P2^0;
sbit drdy=P1^0;
sbit p11=P1^7;
uchar flag=0;
char temp[10];
//--------------------------------------------------------------------------
void delay1(uint z)
{
uint t1y;
for(t1=z;t1>0;t1--)
for(y=110;y>0;y--);
}
//--------------------------------------------------------------------------
unsigned int ad7705_read(void)
{
unsigned int a=0;
unsigned char i=0;
if(drdy==0)
for( i=0; i<16; i++ )
{
a <<= 1;
clk=0;
delay1(6);
if(p11)
{
a++;
}
clk=1;
delay1(6);
}
return a;
}
//--------------------------------------------------------------------------
评论
共有 条评论