Board logo

标题: 求助MC68HC908QY4的自动唤醒问题 [打印本页]

作者: zc6618    时间: 2010-12-10 16:16     标题: 求助MC68HC908QY4的自动唤醒问题

刚接触FREESCALE不知道怎么设置stop和自动唤醒模式,请各位大侠帮帮忙~
代码大概如下:

#include <hidef.h> /* for EnableInterrupts macro */
#include <MC68HC908QY4.h> /* include peripheral declarations */
#define OUT_TURN  PTA_PTA1
unsigned int timer_count;
interrupt void MTimerInt(void) //Counter(10ms)
{
  TSC_TOF = 0;//Clear the flag of Timer1 overflow
  __RESET_WATCHDOG();
   timer_count++;
}
interrupt void KBInt(void)
{
OUT_TURN = !OUT_TURN;

KBSCR_ACKK = 1;
KBSCR_KEYF = 0;

//KBIER_AWUIE = 1; //允许键盘中断
}

void main(void) {
  EnableInterrupts; /* enable interrupts */
  /* include your code here */
  
PTA = 0x00;
PTAPUE = 0x00;
DDRA = 0b00001010;
PTB = 0x00;
PTBPUE = 0x00;
DDRB = 0b01111111;
CONFIG2 = 0;
CONFIG1=128+32+16+8+4+2;
TSC = 0x30;   //分频系数为1
TSC0 = 0x04;  //跳变沿捕捉

TMODH = 0x7D;  //Must write high byte before low byte
TMODL = 0x00;  //set 10000微秒 when BUSCLK is 3.2MHz
  
KBIER_AWUIE = 1; //自动复位  KBIER_AWUIE为1允许复位 12-10修改

TSC_TOIE = 1;  //Timer溢出中断允许
TSC0_CH0IE = 1;  //Timer CH0中断允许
TSC_TSTOP = 0;  //开始计数
  for(;;) {
    __RESET_WATCHDOG(); /* kicks the dog */
   
    if(timer_count>=2)
    {
     asm stop;
     asm stop;
     timer_count = 0;
    }
   
  } /* loop forever */
}




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0