whats wrong with this little code?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

whats wrong with this little code?

297 Views
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) 
{

}
Labels (1)
0 Kudos
0 Replies