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

📄 timer.c

📁 freescale芯片9s12dp256的示例程序
💻 C
字号:
#include <mc9s12c32.h>     /* derivative information */
#include "can.h"
#include "pwm.h"
#include "sci.h"
#include "timer.h"

#include "event.h"
#pragma CODE_SEG DEFAULT


void TIM_Init(void)
{
  TC0 = 0xC34F;          // Store given value to the compare register
  TC7 = 0xC34F;          // Store given value to the modulo register 
  TSCR2_PR = 0X04;       // Store given value to the prescaler 
  TFLG1 = 0x01;          // Reset interrupt request flag
  TIE_C0I = 1;           // Enable interrupt 
  TIOS_IOS0 = 1;
  TSCR1_TEN = 1;         // Enable Timer
}

#pragma CODE_SEG __NEAR_SEG NON_BANKED // Interrupt section for this module. Placement will be in NON_BANKED area.
interrupt 8 void TI2_Interrupt(void)
{
  TFLG1 = 0x01;          // Reset interrupt request flag 
  TIM_OnInterrupt();     // Invoke user event 
}

#pragma CODE_SEG DEFAULT 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -