紧急求助!
本人使用gcc +avrstudio 开发ATtiny13A 芯片,遇到奇怪问题,当代码如下时:
while(1)
{
read_nADCs_reault(&ADC_count_total,NUM_ADCs);
ADC_count_total = ADC_count_total>>2;
curr_percent -= (ADC_count_total-DES_ADC)*0.6;
if(curr_percent >100)
{
curr_percent = 100;
}
if(curr_percent < 0)
{
curr_percent = 0;
}
curr_percent = curr_percent*0.256;
}
编出出来结果是:
AVR Memory Usage
----------------
Device: attiny13a
Program: 298 bytes (29.1% Full)
(.text + .data + .bootloader)
Data: 10 bytes (15.6% Full)
(.data + .bss + .noinit)
但是当在上述代码if 语句内加入一条寄存器配置的语句时 如
if(curr_percent >100)
{
curr_percent = 100;
PORTB |= 1<<4;
}
这种情况出现:
Program: 3692 bytes (360.5% Full)
(.text + .data + .bootloader)
Data: 274 bytes (428.1% Full)
(.data + .bss + .noinit)
程序和数据全部超出范围
另外如果在最后一句加入OCR0A = curr_percent;时同样会出现编译之后代码超出非常多的情况,那位遇到过或者知道怎么解决,请赐教!!非常感激!!
|