⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adcsingl.c

📁 ADuC841中的AD与DA转换的相关例子的源程序
💻 C
字号:
/*********************************************************************

 Author        : ADI - Apps            www.analog.com/MicroConverter

 Date          : October 2003

 File          : ADCsingl.c

 Hardware      : ADuC841

 Description   : Performs repeated single ADC conversions and moves
                 results to UART. 

		
*********************************************************************/

#include<stdio.h>
#include<aduc841.h>

sbit LED = 0x0B4;                //P3.4 drives red LED on eval board

void adc_int() interrupt 6{
	LED=1;
	printf("\n%02BX%02BX\n",ADCDATAH,ADCDATAL);
	return;
			  }
void DELAY(int);			// Function prototype
void main(void)
{
int  CHAN=0;

/* Set up UART */
T3CON = 0x086;
T3FD = 0x08;
SCON   = 0x052;

/* PRECONFIGURE...*/

ADCCON1 = 0x08C;      // power up ADC /32 + 4 acq clock
ADCCON2 = CHAN;				// select channel to convert
EA	= 1;				// enable interrupts
EADC	= 1;				// enable ADC interrupt

/* PERFORM REPEATED SINGLE CONVERSIONS...*/

for(;;)
{
SCONV = 1;				// Perform single conversion
while (LED==0){}
LED=0;
}

}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -