whats wrong with this little code?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

whats wrong with this little code?

602 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by navidrct on Sat Jun 13 22:24:48 MST 2015
hi
im new in ARM and Keil.
i want to work with adc of lpc1768 and i wrote this code . y does not working?
#include "LPC17xx.h"                    // Device header
#include "GPIO_LPC17xx.h"               // Keil::Device:GPIO

uint32_t voltaj = 0 ;

int main()
{
LPC_SC->PCONP |= ((1 << 12) | (1 << 15));  /* enable power to ADC & IOCON   */
LPC_ADC->ADCR    =  ( 1 <<  0) |           /* select AD0.0 pin              */
                      ( 1 <<  13) |          /*  freq=1M/33                   */
                      ( 1 << 21)|             /* enable ADC  */              
                      ( 1 << 24);              /*start conversion*/                 
LPC_ADC->ADINTEN =  ( 1 <<  8) | (1 << 0); /* global ADC enable interrupt   */
NVIC_EnableIRQ(ADC_IRQn);                  /* enable ADC Interrupt          */

while(1)
{
voltaj = LPC_ADC->ADDR0;
}
}
void ADC_IRQHandler(void) 
{

}
标签 (1)
0 项奖励
回复
0 回复数