| 查看: 553 | 回复: 0 | ||
人生如梦s铜虫 (小有名气)
|
[求助]
MC9S12XS128单片机定时器模块这个程序怎么编译一直出错,应该怎么修改
|
|
#include <hidef.h> /* common defines and macros */ #include "derivative.h" /* derivative-specific definitions */ #define LED0 PORTB_PB0 #define LED1 PORTB_PB1 #define LED2 PORTB_PB2 void ECTInit(void) { TSCR2_TOI = 1; //定时器溢出中断使能 TSCR1_TEN = 1; //定时器使能 TIOS_IOS0 = 1; // 设置通道0为输出比较 TIOS_IOS1 = 1; // 设置通道1为输出比较 TC0 = 10000; TC1 = 20000; TIE_C0I = 1; // 使能 channel 0 中断 TIE_C1I = 1; // 使能 channel 1 中断 TCTL2_OL0 = 1; TCTL2_OM0 = 0; TCTL2_OL1 = 1; TCTL2_OM1 = 0; } void main(void) { ECTInit(); DDRB = 0X07; EnableInterrupts; for(; { } } interrupt VectorNumber_Vtimovf void ECT_TimerOverflow_ISR(void) { TFLG2 = TFLG2_TOF_MASK; //清零定时器溢出中断标志 LED0 = ~ LED0; } interrupt VectorNumber_Vtimch0 void ECT_0_ISR(void) { TFLG1 = TFLG1_C0F_MASK; //清除通道0中断标志 LED1 = ~ LED1; } interrupt VectorNumber_Vtimch1 void ECT_1_ISR(void) { TFLG1 = TFLG1_C1F_MASK; //清除通道1中断标志 LED2 = ~ LED2; } |
» 猜你喜欢
297,工科调剂?河南农业大学本科
已经有11人回复
22专硕求调剂
已经有11人回复
284求调剂
已经有20人回复
291求调剂
已经有7人回复
296求调剂
已经有5人回复
一志愿沪9,生物学326求调剂
已经有4人回复
生物学调剂
已经有8人回复
22408 312求调剂
已经有19人回复
26年电池方向博士申请
已经有4人回复
0854调剂
已经有16人回复













{ }
回复此楼