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

* 13427: 硬件:有人用过AD7706吗??SOS

   charlie22 
charlie22发表的帖子 

 硬件:有人用过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,初始化不成功的。软硬件和资料是符合的啊,怎么会有这么
奇怪的问题呢???


发表时间:2002年11月4日15:02:00

  
回复该帖

本主题共有 2 帖,分页:>>>>>该主题的所有内容[2]条

 *树形目录 只列出部分跟帖的标题以及简单的摘要信息 该主题的部分跟帖如下:

  93067.[详细]是否是数据类型错误
摘要:7706是16位ad转换,你在函数read_7706()中data是否应该定义成unsigned int?char是8位......(79字)
- [limncn][1084次] 2006年5月19日

[上一篇帖子]:您用的什么模块,您用的什么模块,用信箱交流吧,rainny.huang@bjsi.com
[下一篇帖子]:老大我也要一份!