Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How to extract ADC data in LPC2368

Status
Not open for further replies.

bikashh

Full Member level 5
Full Member level 5
Joined
Nov 28, 2009
Messages
264
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
india
Activity points
3,132
Dear friends, i am really confused about how to extract binary data from ADC and how to convert it to the corresponding decimal value.
i've written a program according to my understanding but its not giving any data.

void ADC0Read( char channelNum )
{

DWORD regVal, ADC_Data, ADC_Data1;
int i;
unsigned char binary_data[12];

AD0CR &= 0xFFFFFFFE;
AD0CR |= (1 << 24) | (1 << channelNum);
/* switch channel,start A/D convert */

for(i=0;i<13;i++)
{binary_data='\0';}
AD0CR &= 0xF8FFFFFF; /* stop ADC now */

while((AD0DR0 & 0x80000000)==0);
ADC_Data = ( regVal >> 6 ) & 0x3FF;
for(i=10;i<=0;)
{
binary_data = (ADC_Data1 = (ADC_Data%10)); //extracting each bit
ADC_Data = ADC_Data1;
i--;
}
binary_data[11]='\0';
read_data=1;
uart0Puts("ADC BINARY DATA->");
uart0Puts((char*)binary_data); /* return A/D conversion value */
uart0Puts("\n\r");

}



thanks in advance
 

because that did't solve my query
 

Yes but this is why your previous thread is still open, if someone can help he will post an answer there.
There are hundreds of threads that don't get solved, can you imagine what it would be like if each user would repost the same question to a new thread because he didn't receive an answer or didn't solve the problem in the previous thread.

Alex
 

Actually i was a bit frustrated thats why i posted this thread
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top