首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

求助MC68HC908QY4的自动唤醒问题

求助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 */
}
返回列表