charlie22
驱动牛犊
驱动牛犊
  • 注册日期2002-08-05
  • 最后登录2007-11-28
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:945回复:0

有人用过AD7706吗???

楼主#
更多 发布于:2002-11-04 14:52
调了两天都不通啊!!!
硬件采用与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,初始化不成功的。软硬件和资料是符合的啊,怎么会有这么奇怪的问题呢???





游客

返回顶部