Files
2026-10-19 15:33:00 +08:00

101 lines
2.7 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**************************************************************************
**************************************************************************/
#include "Define_Global.h"
/**************************************************************************
* 函数名称:Deal_BackPress
* 函数功能:过压处理
* 入口参数:无
* 出口参数:无
* 备 注:中断调用
**************************************************************************/
void Deal_BackPress()
{
if(CM1IF)
{ //1级过压
CM1IF = 0;
B_Protect_BackPress = 1; //进入过压保护
Time_BackPress = 0;
}
//---------------------------------------------------------------------
if(Time_BackPress >= 10) //83.33ms\100ms,过压保护延时计时
{
B_Protect_BackPress = 0; //退出过压保护
}
}
/**************************************************************************
* 函数名称:Deal_IgbtOVUV
* 函数功能:IGBT驱动过欠压处理
* 入口参数:无
* 出口参数:无
* 备 注:中断调用
**************************************************************************/
void Deal_IgbtOVUV()
{
if(!Pin_Igbt_OVUV) //检测口为低电平
{ //IGBT驱动过欠压保护
B_Protect_Stop = 1; //硬件保护停止
Delay_ProtectStop = 0;
Flag_PPG = 0; //PPG输出关闭
B_PPG_On = B_PPG_Out = 0;
B_Pan_Error = B_Pan_No = B_Pan_Have = 0;
}
}
/**************************************************************************
* 函数名称:Deal_IntTime
* 函数功能:中断时间处理
* 入口参数:无
* 出口参数:无
* 备 注:中断调用
**************************************************************************/
void Deal_IntTime()
{
static unsigned char Delay_IntTime;
//---------------------------------------------------------------------
if(B_Zero_No)
{ //无过零信号
if(++Delay_IntTime >= 10000/C_TimeUS_Int) //10ms
{
B_Zero_Time = 1; //过零翻转(时间处理)
}
}
//---------------------------------------------------------------------
if(B_Zero_Time) //60Hz=8.333ms,50Hz\无过零=10ms
{
B_Zero_Time = 0;
Delay_IntTime = 0;
Time_BackPress++; //过压保护处理计时
Time_HMI++; //人机界面处理计时
}
}
/**************************************************************************
--------------------------------- 中断处理 --------------------------------
**************************************************************************/
void interrupt Isr_Timer()
{ //定时器中断
if(TMR2IF)
{
TMR2IF = 0; //清中断标志
Deal_BackPress(); //过压处理
Deal_IgbtOVUV(); //IGBT驱动过欠压处理
Deal_IntTime(); //中断时间处理
__CMS_Plus_Interrupt(); //中断增强处理
Check_AD(); //AD检测
#if _MODE_IHDEBUG_
REL_IhDebug_Int(); //IH调试处理(中断)
#elif !_MODE_COMM_NO_
Communicate(); //芯片通信
#endif
}
}