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.

[ARM] ADC prblem in LPC2148 showing constant values

Status
Not open for further replies.

msreenu92

Newbie level 1
Newbie level 1
Joined
Feb 28, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,288
any one can help me


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void ADC_init()
{   
    VPBDIV=0x00;
    PINSEL1|=(1<<24)|(1<<26);   // CONFIGURE THE PIN FUNCTION FOR ADC
    AD0CR|=(1<<1)|(1<<2);    
    AD0CR |=0x00210F00;
}
 
unsigned int temp()
{
 unsigned char i=0;
 AD0CR |= 0x01000000;        
 do
      {
        i = AD0GDR; // Read A/D Data Register
      } while ((i & 0x80000000) == 0); // Wait for end of A/D Conversion
        AD0CR &= ~0x01000000;
       return (i >> 6) & 0x03FF; 
}
 
unsigned int light()
 {
   unsigned char data;
 AD0CR |= 0x01000000;        
 do
      {
        data = AD0GDR; // Read A/D Data Register
      } while ((data & 0x80000000) == 0); // Wait for end of A/D Conversion
        AD0CR &= ~0x01000000;
       return (data >> 6) & 0x03FF; 
}

 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top