日韩在线不卡免费视频一区,日韩欧美精品一区二区三区经典,日产精品码2码三码四码区,人妻无码一区二区三区免费,日本feerbbwdh少妇丰满

  • 回復(fù)
  • 收藏
  • 點(diǎn)贊
  • 分享
  • 發(fā)新帖

atmega48v不能進(jìn)入掉電模式

我用ATMEGA48v , ICC-AVR寫了這樣一段程序, IO 不允許中斷功能,全部 初始
為輸出電平!  定時(shí)器,AD,看門狗全部禁止(燒錄FUSE選項(xiàng)時(shí)也有禁止); 然后寫掉電模式指令后, 燒錄程序到MCU后, MCU不能進(jìn)入掉電模式, 仍然以200MS 周期復(fù)位一次(非喚醒, 如果是正常喚醒LEDE會(huì)翻轉(zhuǎn),但LEDE一直為熄滅狀態(tài)), LEDF 指示燈 不停 翻轉(zhuǎn); 而用AVRSTUDIO軟件模擬時(shí)卻沒(méi)有這個(gè)問(wèn)題.

請(qǐng)教一下 這是怎么引起的. 哪位兄弟能不能提供一個(gè)可以進(jìn)入掉電模式的程序段給我學(xué)習(xí)一下. 謝謝!!


void port_init(void)
{
PORTB = 0x00;
DDRB  = 0xFF;
PORTC = 0x00; //m103 output only
DDRC  = 0x7F;
PORTD = 0x00;
DDRD  = 0xFF;
}

//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();

MCUCR = 0x00;
EICRA = 0x00; //extended ext ints
EIMSK = 0x00;

TIMSK0 = 0x00; //timer 0 interrupt sources
TIMSK1 = 0x00; //timer 1 interrupt sources
TIMSK2 = 0x00; //timer 2 interrupt sources

PCMSK0 = 0x00; //pin change mask 0
PCMSK1 = 0x00; //pin change mask 1
PCMSK2 = 0x00; //pin change mask 2
PCICR = 0x00; //pin change enable
PRR = 0xFF; //power controller
SEI(); //re-enable interrupts
//all peripherals are now initialized
}
//=============================
main()
{
   if(i!=0x55)
     { init_devices();
     }
     i = 0x55 ;
     watchdog_init();
CLI();
ADCSRA = 0x00;
EIMSK = 0x00;  //外部中斷X允許
EIMSK=0X00;
     PCIFR = 0X07; //清中斷符

WDR();
WDTCSR |= (1< WDTCSR=0X00;


PRR=0XfF;
SMCR=0X05;

waitsleep:
PORTB^=(1< asm ("sleep");
PORTD^=(1< goto waitsleep;

    SMCR&=~(1<    SMCR&=~(1<
全部回復(fù)(1)
正序查看
倒序查看
baipl5155
LV.1
2
2009-10-26 22:40
還請(qǐng)大家賜教!!
0
回復(fù)
發(fā)