Hi, you are trying to configure channel and start ADC at the same time. I don't know which LPC2xxx you are using but you should check the corresponding errata for details. Assuming that you have declared ADCR volatile I advise you to use this code: ADCR = (ADCR & 0xFFFFFF00) | (1 << 1) & (~(1 << 24)); ADCR = (ADCR & 0xFFFFFF00) | (1 << 24); In order to avoid the bug and to be sure that you will not start the ADC twice. Regards Zdravko Dimitrov --- heedaf <ruffellfamily@...> wrote: > I've got the following code to start the ADC. If I > put in a > breakpoint somewhere after the code and run to the > breakpoint it will > enter an endless loop. If I step manually past the > while statement > and than run to the breakpoint it will work fine. > If I put in a delay > before the while statement it also works but this > seriously slows down > the ADC. I guess this has something to do with > initialization but I'm > not sure. Does anyone have any ideas? > Thanks, > Dewayne > > ADCR = (ADCR & 0xFFFFFF00) | (1 << 1) | (1 << 24); > > //wait til done > > while((ADDR & 0x80000000) == 0) > ; > > //get result > return (ADDR>>6) & 0x3FF; > > > > \u0417\u043d\u0430\u043d\u0438\u0435\u0442\u043e \u0435 \u043b\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0436\u0438\u0432\u044f\u043d\u0430 \u0438\u0441\u0442\u0438\u043d\u0430. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Message
Re: [lpc2000] ADC Problem
2006-05-11 by 3gpabko
Attachments
- No local attachments were found for this message.