/*
====================================================
Name : main.c
Author : zhdphao
Version :
Copyright : (C) Copyright v1.0
Description : main definition
====================================================
*/
#ifdef __USE_CMSIS
#include "LPC13xx.h"
#endif
int32_t adc_value;
// TODO: insert other include files here
// TODO: insert other definitions and declarations here
int main(void) {
// TODO: insert code here
// Enter an infinite loop, just incrementing a counter
//volatile static int i = 0 ;
LPC_SYSCON->SYSMEMREMAP = 0x03;
LPC_SYSCON->SYSOSCCTRL = 0x00;
LPC_SYSCON->CLKOUTDIV = 0X78;
LPC_SYSCON->SYSAHBCLKCTRL = 0x20DF;
LPC_IOCON -> PIO1_4 =0x41; //AD5通道,
LPC_ADC->INTEN=0x00; //无ADC中断
LPC_ADC->CR=0x1000B20; //马上开始转换,PCLK/12,AD5
while(LPC_ADC->STAT!=0X20) //查询等待ADC完成
{
}
adc_value=LPC_ADC->DR5; //读AD5数据
return 0 ;
} |