📄 inter.c
字号:
/************************************************
* 文件名:inter.c *
* 文件功能:中断服务程序 *
* 作者:xxlxws *
* 日期:2007-05-15 *
* 版本号:1.0 *
************************************************/
#include <ioavr.h>
#include <intrinsics.h>
#include "mylib.h"
#include "common.h"
#include "main.h"
#include "init.h"
#include "func.h"
#include "inter.h"
extern struct _Led Led;
extern struct _Data Data;
extern struct _Count Count;
extern struct _Moto Moto_A,Moto_B,Moto_Mid,Moto_HT;
extern uint8 Mass[4];
extern uint8 LedCode[10];
/************************************************
* 函数名:Inter_Timer0_CMPA *
* 入口参数:无 *
* 出口参数:无 *
* 作者:xxlxws *
* 日期:2007-05-15 *
* 函数功能:16.32ms溢出产生PWM,控制振动电机MA*
************************************************/
#pragma vector=TIMER0_COMPA_vect
__interrupt void Inter_Timer0_CMPA(void) /*16ms溢出*/
{
Moto_A.Count++;
Moto_Mid = Moto_A;
Moto_Mode_Set();
Moto_A = Moto_Mid;
OCR0A = Moto_A.Mass;
return;
}
/************************************************
* 函数名:Inter_Timer0_CMPB *
* 入口参数:无 *
* 出口参数:无 *
* 作者:xxlxws *
* 日期:2007-05-15 *
* 函数功能:32us溢出产生PWM,控制加热片HT *
************************************************/
#pragma vector=TIMER0_COMPB_vect
__interrupt void Inter_Timer0_CMPB(void) /*32us溢出*/
{
OCR0B = Moto_HT.Mass;
return;
}
/************************************************
* 函数名:Inter_Timer1 *
* 入口参数:无 *
* 出口参数:无 *
* 作者:xxlxws *
* 日期:2007-05-15 *
* 函数功能:320us溢出,定时、LED显示及键盘扫描*
************************************************/
#pragma vector=TIMER1_OVF_vect
__interrupt void Inter_Timer1(void) /*320us*/
{
return;
}
/************************************************
* 函数名:Inter_Timer2_CMPB *
* 入口参数:无 *
* 出口参数:无 *
* 作者:xxlxws *
* 日期:2007-05-15 *
* 函数功能:32us溢出产生PWM,控制振动电机MB *
************************************************/
#pragma vector=TIMER2_COMPB_vect
__interrupt void Inter_Timer2_CMPB(void) /*32us溢出*/
{
Moto_B.Count++;
Moto_Mid = Moto_B;
Moto_Mode_Set();
Moto_B = Moto_Mid;
OCR2B = Moto_B.Mass;
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -