Soren:
My apologies and thanks for your response. I finally got the ADC to
work by doing a complete AD0CR setting with start, waited for the
done, read the value, and I was in business.
Regards,
Steve
--- In lpc2000@yahoogroups.com, "soren_t_hansen"
<soren_t_hansen@y...> wrote:
> --- In lpc2000@yahoogroups.com, "stiffsoft" <stiffsoft@s...> wrote:
> > Hello,
> > Does anyone have any C code that actually reads the MCB2130
> > hardware ADC on AIN1 (the potentiometer tied to P0.28) they
would be
> > willing to share? I have tried the Keil code, the Hitex example
> > code, manipulating bit values, etc., for most of 2 days and
cannot
> > get ADC to return a value that I can display via COM1 on the
> > MCB2130. The code I have been exploring uses hardware
continuous
> > conversions rather that software interrupt driven conversions.
I
> > really thought the hardware conversion would be easier to
implement
> > than the software.
> > I verified that the voltage varies at P0.28 with a DMM when I
> > adjust the pot, but I get nothing but 0 from AD0DR.
> > I contacted Keil via telephone and didn't get much help (other
> > than suggesting I run it in the simulator -- more stuff to
learn).
> > I also sent my source code to their support center, but have not
> > received a response.
> > Any suggestions (or simple code hints) will be greatly
> > appreciated.
> >
> > Steve Stiff
>
> Have you made sure that the J2 jumper is set? Also make sure that
you
> use the lpc213x.h instead of the lpc21xx.h
> I'm using the following code as a small example:
>
> AD0CR |= 0x01200000; /* Start A/D Conversion
*/
> do {
> val = AD0DR; /* Read A/D Data
Register */
> } while ((val & 0x80000000) == 0); /* Wait for end of A/D
> Conversion */
> AD0CR &= ~0x01000000; /* Stop A/D Conversion
*/
>
> Is this the same as you have?
>
> Best Regards
> Søren HansenMessage
Re: LPC2138 ADC
2005-06-14 by stiffsoft
Attachments
- No local attachments were found for this message.