Analog on a custom PCB

14 Dec 2012

I have an LPC1768 on a custom PCB. When I try to read the analog pin the code just locks up. Any idea why? I tried it as in int and a float. If I comment out the line with the analog stuff in it then it works fine.

#include "mbed.h"
AnalogIn ain(p20);
PwmOut      led1(LED1);
PwmOut      led4(LED4);

int main()
{
    led1 = 1;
    while(1) 
    {

   //     float p= ain;
        unsigned short i = ain.read_u16();
        led1 = 1;
        led4 = 0;

        wait(0.2);
        led1 = 0;
        led4 = 1;
        wait(0.2);

    }
}
15 Dec 2012

See the discussion here from a week or so ago:

'AaaaaaaaaanalogIn'

http://mbed.org/forum/helloworld/topic/4191/

16 Dec 2012

I figured out my problem. I had a bad inductor between 3.3V and VDDA. So VDDA was not getting power. The result is the code locks up when you try to read the ADC.