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.

Help me find the error in this ADC code for LPC2148

Status
Not open for further replies.

saidutt

Member level 2
Joined
Dec 4, 2009
Messages
43
Helped
6
Reputation
12
Reaction score
4
Trophy points
1,288
Location
india
Activity points
1,592
hi friends,

i am new to ARM micro-controller.i need to write ADC code for data logger unit.
so, i am working on it .the data from ADC( ADC0 and ADC1) is not been displayed on hyper terminal .controller is been waited for forever ( AD0DR1, last bit to be set as '1' =31 bit).


Code:
	void adc_1_channel2()
			{	unsigned char out,c1[]="channel 2:";
				unsigned int i,val;
				for(i=0;i<11;i++)
				send_data(c1[i]);
			//	PINSEL0&=0x00050000;
			PINSEL1 = 0x01000000;
			 AD0CR   &= 0x00200602;
			 AD0CR|=(1<<24);  
			   // AD1CR=0x00250604;
			//	AD1CR|=0x01000000;
				do
				{//val=AD1DR2;
				val=AD0GDR;
				}
				while((val&0x80000000)==0);  // going into infinite loop.
				out=(val>>6)&0xff;                //data is not displayed
				hex_to_decimal(out);

			}
data is been not displayed.
i coudn't identify the error.

so please help me out


thank you.[/code]
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top