LPC2148 ADC not working properly

OP (Company: Robogenesis) #3778036
Rate this post
• ▲ useful
▼ not useful
I am noobie in Arm programming and  LPC2148 i have a written a program 
for ADC to glow Leds. it is not working properly. i am not able to see 
the LED glowing.

 i think there is some confusion for operating frequency but i am not 
sure

Can anyone suggest anything.?
come on guys. Show some attachment to the new guy.

this is my code:

#include<lpc214x.h>

static unsigned short ADC_Read(unsigned char ch)
{
  unsigned int i;
  AD0CR=0x00200300 | ch;
  AD0CR|=0x01000000;
  do
  {
    i=AD0DR0;
  }
  while((i & 0x80000000)==0);
  return (i >> 6) & 0x03ff;
}


int main()
{
unsigned int z;

IO1DIR=0xffffffff;

       while(1)
        {
         z=ADC_Read(1);
         if (z<500)
         IOPIN1=0x000;
         else if (z>500)
         IOPIN1=0xff;
        }

/*unsigned int z=500;
PINSEL0=0x00000f00;
PINSEL1=0x05500000;
PINSEL2=0x00000000;
IO1DIR=0xffffffff;
AD0CR= 0x00200301;

  while(1)
    {
 while((AD0GDR&0x80000000)==0x00);
  z=(AD0GDR&0x00000ffc0);
  z=(z>>6);
  IOPIN1=0xfffffff;
  delay(z);
  IOPIN1=  0x0000000;
  delay(z);
    }
  */
  }
Attached files:

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.