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

📄 adc-s3c44b0.c

📁 吐血奉献基于ARM的启动代码bootloader
💻 C
字号:
#include "..\inc\44b.h"
#include "ADC-S3C44B0.h"


void init_ADdevice()
{
	rADCPSR=20;
	rADCCON=ADCCON_SLEEP;
}

int GetADresult(int channel)
{
	rADCCON=(channel<<2)|ADCCON_ENABLE_START;
	Delay(1);
	while(!(rADCCON&ADCCON_FLAG));
	return rADCDAT;
}

void ADTest()
{
	int index;

	Uart_Printf("\nTest AD from channel 0 to 3.  Press any key return\n");
	init_ADdevice();

	index=Set_UartLoopFunc(ADTest_Loop);
	Uart_Getch(0);
	Clear_UartLoopFunc(index);
}


void ADTest_Loop()
{
	static int count=0;
	int i;

	count++;
	if(count<50000)
		return;

	count=0;

	Uart_Printf("\r");
	for(i=0;i<4;i++){
		Uart_Printf("%8AD%d=%4.4d",i,GetADresult(i));
		Delay(100);
	}
	
}

⌨️ 快捷键说明

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