正文

串行八位模数转换电路adc0832应用文档2011-09-14 22:55:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/enc999/52790.html

分享到:

ADC0832

The ADC0831 series are 8-bit successive approximation A/D converters with a serial I/O and configurable input multiplexers with up to 8 channels. The serial I/O is configured to
comply with the NSC MICROWIRE™ serial data exchange standard for easy interface to the COPS™ family of processors, and can interface with standard shift registers or µPs.
The 2-, 4- or 8-channel multiplexers are software configured for single-ended or differential inputs as well as channel assignment. The differential analog voltage input allows increasing the common-mode rejection and offsetting the analog zero input voltage value. In addition, the voltage reference input can be adjusted to allow encoding any smaller analog voltage span to the full 8 bits of resolution.

ADC0832 Timing



From the figure above to read data from ADC. First, we must send 3 bit command then read 8 bit data from ADC.MSB first for both command and data.

You have 2 choice to use ADC0832.One for Single-Ended MUX Mode and one for Differential MUX Mode.For first mode use will get 2 channel of ADC but 1 channel for second mode.

MUX Addressing: ADC0832 Single-Ended MUX Mode



MUX Addressing: ADC0832 Differential MUX Mode




Interfacing with MCS-51

In this example I use KEIL C51 software for programming the AT89S52 to interfae with ADC0832.The result of reading ADC will send to serial port and display with Hyper terminal program on the Windows or other serial port monitor software.



ADC0832 use serial I/O interface with microcontroller devices as mention above. We can coding the routine for read the data from ADC0832 as follwing:

Read ADC function Single-Ended MUX Mode (KEIL C51 V7.5)

sbit ADC_CS 	=  P2^0;
sbit ADC_CLK 	=  P2^1;
sbit ADC_DO 	=  P2^2;
sbit ADC_DI 	=  P2^3;

//---------------------------------------
// read analog from ADC
// Single end mode(2 channel)
//---------------------------------------
char ReadADC(unsigned char channel)
{
   unsigned char i,k;
   unsigned char AdcResult;  // 8 bit

   ADC_CS=0;  	// Active chip select
   k++;			// Delay about 1 uS
   ADC_CLK=0; 	// make clock low first   
   k++;k++;	
   channel = channel? 0xE0 : 0xC0;
   k++;k++;  		// delay about 2 uS
   //--- write command 3 bit ----------
   for(i=0; i< 3;i++) {
      ADC_DI = (channel & 0x80) != 0;
      channel=channel<<1;
      ADC_CLK=1;
      k++;k++;		// delay about 2 uS
      ADC_CLK=0;
   }

   //--- read ADC result 8 bit --------
   AdcResult=0;
   for(i=0;i<8;++i) {
      ADC_CLK=1;
      k++;k++;  		// delay about 2 uS
      ADC_CLK=0;
      k++;k++;  		// delay about 2 uS 
      AdcResult=AdcResult<<1;
      AdcResult=AdcResult | (ADC_DO & 0x01);	  
      ADC_CLK=1;
      k++;k++;  		// delay about 2 uS 
      ADC_CLK=0;
      k++;k++;  		// delay about 2 uS
   }
   ADC_CS=1;
   return(AdcResult);	
}

The result of this example show as the following figure

阅读(3410) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册