导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→硬件:有人用过AD7706吗??SOS[charlie22]

 *第5928篇: 硬件:有人用过AD7706吗??SOS

  
楼 主:charlie22 2002年11月4日15:02
 硬件:有人用过AD7706吗??SOS
调了两天都不通啊!!!
硬件采用与52串口同步通信,即txd接7706-SCLK,rxd接7706的Din和Dout。(datasheet上的
典型电路)

7706寄存器读写和初始化程序如下:
unsigned char read_7706()
{
unsigned char dat;
RI=0;
while(RI==0);
dat=SBUF;
return dat;
}

void write_7706(unsigned char dat)
{
TI=0;
SBUF=dat;
while(TI==0);
TI=0;
}


/*;*** AD7706 ANALOGUE TO DIGITAL CONVERTOR CONFIGURATION 
*********************************
;
;This is the AD7706 configuration routine 
;
;The ADC configuration steps are as follows:
; 1)Write to the communications register specifying that the next operation to 
be a 
; write to the clock register,select AIN1 (ie 0x20).
;
; 2)Write to the clock register appropiate settings (ie 0x0C)
; - Mclk out enabled
; - Input clock divided by two 
; - Update rate of 20 ms or 50 Hz which gives
; a 3 dB digital filter cutoff of 13.1 Hz

; 3)Write to the comms register specifying that the next operation to be a 
write to 
; the setup register and a calibration on channel 3 (ie 0x13)
;
; 4)Write to the setup register appropiate settings (0x54)
; - perform self calibration on channel 3
; - Gain of 4 (max input voltage 0.625 !!)
; - unipolar mode
; - on chip buffer enabled
; - clear Fsync to begin a conversion
*/
void init_7706()
{

write_7706(0x20); //1.write communication reg,next write clock reg
write_7706(0x0C); //2.write clock reg,

write_7706(0x08); //.write communication register,next read communication 
register 
temp=read_7706(); //read communication register

write_7706(0x28); //next read clock register 
temp=read_7706(); //read clock register

write_7706(0x10); //3.write communication register,next write set register
write_7706(0x40); //4.write set register

write_7706(0x08); //next read communication register 
temp=read_7706(); //read communication register

write_7706(0x18); //next read set register 
temp=read_7706(); //read set register


}

发现读出的寄存器值均为0xff,初始化不成功的。软硬件和资料是符合的啊,怎么会有这么
奇怪的问题呢???

  
2楼:limncn 2006年5月19日15:19
 是否是数据类型错误
7706是16位ad转换,你在函数read_7706()中data是否应该定义成unsigned int?char是8位

>>>>>>对该主题发表你的看法

本主题贴数2,分页: [第1页]


[上一篇主题]:C51编程:unsigned long 型16进制数如何转为4字节BCD码??

[下一篇主题]:硬件:请教:一个与AT89C55WD复位有关的问题