adc in lpc1768

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

adc in lpc1768

542 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Dec 01 03:38:54 MST 2015
Hi everybody
I am using ADC (LPCOPEN) ifor LPC1768 .
for adc3 I see that dataADC have reasonable numbers that has a bit jumb ( does not mater)
but in adc4  every time that I read it dataADC isnot the same.

I donot know why
I 've done every thing  
such as
{1,   30,  (0x0 << 7) | IOCON_FUNC2},,/* AD4_PS */
{0,   26, (0x0 << 7) | IOCON_FUNC1},/* AD2_VBAT */

is that right ?
Labels (1)
0 Kudos
1 Reply

393 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Sat Dec 26 05:50:44 MST 2015
in init part I 've done :
 Chip_ADC_Init(LPC_ADC, &ADCSetup);
  Chip_ADC_EnableChannel(LPC_ADC, ADC_CH2, ENABLE);
  Chip_ADC_Init(LPC_ADC, &ADCSetup);
  Chip_ADC_EnableChannel(LPC_ADC, ADC_CH3, ENABLE);
  Chip_ADC_Init(LPC_ADC, &ADCSetup);
  Chip_ADC_EnableChannel(LPC_ADC, ADC_CH1, ENABLE);
  Chip_ADC_Init(LPC_ADC, &ADCSetup);
  Chip_ADC_EnableChannel(LPC_ADC, ADC_CH0, ENABLE);
  
  Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);
  
 Chip_ADC_SetSampleRate(LPC_ADC, &ADCSetup,ADC_MAX_SAMPLE_RATE);

and when I want to read any pin I 'done:
    Chip_ADC_EnableChannel(LPC_ADC, ADC_CH0, ENABLE);
       Chip_ADC_SetBurstCmd(LPC_ADC, DISABLE);
       Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);
       while (Chip_ADC_ReadStatus(LPC_ADC,  ADC_CH0, ADC_DR_DONE_STAT) != SET) { }
      /* Read ADC value */
         Chip_ADC_ReadValue(LPC_ADC,  ADC_CH0, &dataADC);
             return  dataADC;


Am i miss anything ?
please help me
0 Kudos