📄 main.c
字号:
#include <hidef.h> /* common defines and macros */
#include <mc9s12dg128.h> /* derivative information */
#include"pwm.h"
#include"pll.h"
#include"sci.h"
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
uint V=0;
void ECT_Int(void)
{ TIOS_IOS7=0; //设置7为输入捕捉
TSCR1_TEN=1; //开启计数器
TCTL3_EDG7B=0;
TCTL3_EDG7A=1; //上升延捕捉
TIE_C7I=1; //启用输入捕捉中断
TSCR2_TOI=0; //关闭定时器溢出中断
}
void interrupt 15 InputCapure(void) {
DisableInterrupts;
TFLG1_C7F=1; //Clear Flag
V=TCNT; //Read speed
TCNT=0; //Clear couner
EnableInterrupts;
}
void main(void) {
/* put your own code here */
PWM_Init();
PLL_Init();
Start_PLL();
SciInit();
ECT_Int();
EnableInterrupts;
for(;;) {} /* wait forever */
/* please make sure that you never leave this function */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -