智能车制作

标题: 请指教 [打印本页]

作者: gao0708    时间: 2011-1-14 20:46
标题: 请指教
请高手指教一下,下面这个程序是个简单的定时器溢出中断的程序,但就是不对,请指教

#include <hidef.h>      /* common defines and macros */
#include "derivative.h"      /* derivative-specific definitions */
void ECT_Init(void)
{
TSCR2_PR = 2; //预分频系数为8
TSCR2_TOI = 1; //定时器溢出中断使能
TSCR1_TEN = 1; //定时器使能
}

void main(void) {
  /* put your own code here */
  ECT_Init();
  DDRS =0XFF;
  for(;;);
}

#pragma CODE_SEG __NEAR_SEG NON_BANKED
void interrupt TimerOverFlow(void)
{
  PTS =5;        
  TFLG2_TOF = 1;
}




欢迎光临 智能车制作 (http://dns.znczz.com/) Powered by Discuz! X3.2