avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] ADC problem


From: Andi
Subject: [avr-gcc-list] ADC problem
Date: Tue, 26 Feb 2008 16:55:56 +0700

Hi, Guys
 
 
I have problem in my code for ATMega16. This is my code:
............
void InitADC(void)
{
 ADMUX  = 0b11010000;  // Internal 2.56 Volt reference, adjust left, Gain 1x
       // Channel 0 (Positive input) and 1 (Negative input)
 ADCSRA = 0b11111000;
 SFIOR = 0b00000000;
 
}
 

unsigned char GetADCH(void)
{
 unsigned char temp;
 temp = ADCH & 0b00000011;
 return temp;
}
 
unsigned char GetADCL(void)
{
 unsigned char temp;
 temp = ADCL;
 return temp;
}
 
int GetADC(void)
{
 int temp;
 temp = (int)(GetADCH()<<8) | GetADCL(); 
 return temp;
}
 
SIGNAL(SIG_ADC)
{
 // Get Data ADC
 ADC_Data = GetADC(); 
 //int temp;
 //temp = (int)(GetADCH()<<8) | GetADCL();
 //ADC_Data = temp;
}
 
...............
 
The LST file result :
.........
 350:Ampere.c      **** SIGNAL(SIG_ADC)
 351:Ampere.c      **** {
 352:Ampere.c      ****  // Get Data ADC
 353:Ampere.c      ****  ADC_Data = GetADC(); 
 354:Ampere.c      ****  //int temp;
 355:Ampere.c      ****  //temp = (int)(GetADCH()<<8) | GetADCL();
 356:Ampere.c      ****  //ADC_Data = temp;
 357:Ampere.c      **** }
 358:Ampere.c      ****
.........
 
The program is stuck on SIGNAL(SIG_ADC), when I look to list file (*.LST), looks like the compiler not compile the code in SIGNAL(SIG_ADC).
Can you help me where is the problem ?
 
 
Regards
 
 
Andi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]