⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 网上得到FREESCALE 9S12程序
💻 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 + -