📄 alarm.c
字号:
alarm_flag |= ALARM_FLAG_OF_SOUND;
}
if( _SysPotInfo.alarm_light2_2 & BIT1 )
{
alarm_flag |= ALARM_FLAG_OF_LIGHT2;
}
}
else
{
if( TempAlarmSound2 & BIT1 )
{
_SysPotInfo.alarm_sound2 |= BIT1;
}
}
if( AlarmCtlWord2 & ALARM_OF_OV_REQ )
{
if( _SysPotInfo.alarm_light2 & BIT2 )
{
alarm_flag |=ALARM_FLAG_OF_LIGHT;
}
if( _SysPotInfo.alarm_sound2 & BIT2 )
{
alarm_flag |= ALARM_FLAG_OF_SOUND;
}
if( _SysPotInfo.alarm_light2_2 & BIT2 )
{
alarm_flag |= ALARM_FLAG_OF_LIGHT2;
}
}
else
{
if( TempAlarmSound2 & BIT2 )
{
_SysPotInfo.alarm_sound2 |= BIT2;
}
}
if( AlarmCtlWord2 & ALARM_OF_VSEQERR )
{
if( _SysPotInfo.alarm_light2 & BIT3 )
{
alarm_flag |=ALARM_FLAG_OF_LIGHT;
}
if( _SysPotInfo.alarm_sound2 & BIT3 )
{
alarm_flag |= ALARM_FLAG_OF_SOUND;
}
if( _SysPotInfo.alarm_light2_2 & BIT3 )
{
alarm_flag |= ALARM_FLAG_OF_LIGHT2;
}
}
else
{
if( TempAlarmSound2 & BIT3 )
{
_SysPotInfo.alarm_sound2 |= BIT3;
}
}
if( PhaseActive & BIT4 )
{
if( _SysPotInfo.alarm_light2 & BIT4 )
{
alarm_flag |=ALARM_FLAG_OF_LIGHT;
}
if( _SysPotInfo.alarm_sound2 & BIT4 )
{
alarm_flag |= ALARM_FLAG_OF_SOUND;
}
if( _SysPotInfo.alarm_light2_2 & BIT4 )
{
alarm_flag |= ALARM_FLAG_OF_LIGHT2;
}
}
else
{
if( TempAlarmSound2 & BIT4 )
{
_SysPotInfo.alarm_sound2 |= BIT4;
}
}
if( OverVIStateWord & 0x07 )
{
AlarmCtlWord3 |= ALARM_OF_OVER_VOLTAGE;
}
else
{
AlarmCtlWord3 &=~ ALARM_OF_OVER_VOLTAGE;
}
if( OverVIStateWord & 0x70 )
{
AlarmCtlWord3 |= ALARM_OF_OVER_CURRENT;
}
else
{
AlarmCtlWord3 &=~ ALARM_OF_OVER_CURRENT;
}
if( AlarmCtlWord3 & ALARM_OF_OVER_VOLTAGE )
{
if( _SysPotInfo.alarm_light3 & BIT0 )
{
alarm_flag |= ALARM_FLAG_OF_LIGHT;
}
if( _SysPotInfo.alarm_sound3 & BIT0 )
{
alarm_flag |= ALARM_FLAG_OF_SOUND;
}
if( _SysPotInfo.alarm_light2_3 & BIT0 )
{
alarm_flag |= ALARM_FLAG_OF_LIGHT2;
}
}
else
{
if( TempAlarmSound3 & BIT0 )
{
_SysPotInfo.alarm_sound3 |= BIT0;
}
}
if( AlarmCtlWord3 & ALARM_OF_OVER_CURRENT )
{
if( _SysPotInfo.alarm_light3 & BIT1 )
{
alarm_flag |= ALARM_FLAG_OF_LIGHT;
}
if( _SysPotInfo.alarm_sound3 & BIT1 )
{
alarm_flag |= ALARM_FLAG_OF_SOUND;
}
if( _SysPotInfo.alarm_light2_3 & BIT1 )
{
alarm_flag |= ALARM_FLAG_OF_LIGHT2;
}
}
else
{
if( TempAlarmSound3 & BIT1 )
{
_SysPotInfo.alarm_sound3 |= BIT1;
}
}
if( !( PowerStateFlag & PS_BREAKPOWER_FLAG ) )
{
if( ( alarm_flag & ALARM_FLAG_OF_LIGHT ) && ( alarm_flag & ALARM_FLAG_OF_LIGHT2 ) )
{
if( AlarmLightTime == 0 )
{
ALARM_LIGHT();
AlarmLightTime = 1;
_disable_interrupt();
CancleAlarmSoundTime = 4;
_enable_interrupt();
}
else if( AlarmLightTime )
{
ALARM_LIGHT2_ON();
AlarmLightTime = 0;
_disable_interrupt();
CancleAlarmSoundTime = 4;
_enable_interrupt();
}
}
else if( alarm_flag & ALARM_FLAG_OF_LIGHT )
{
ALARM_LIGHT();
_disable_interrupt();
CancleAlarmSoundTime = 4;
_enable_interrupt();
}
else if( alarm_flag & ALARM_FLAG_OF_LIGHT2 )
{
ALARM_LIGHT2_ON();
_disable_interrupt();
CancleAlarmSoundTime = 4;
_enable_interrupt();
}
else
{
ALARM_LIGHT_CANCLE();
ALARM_LIGHT2_OFF();
}
if( alarm_flag & ALARM_FLAG_OF_SOUND )
{
ALARM_SOUND();
_disable_interrupt();
CancleAlarmSoundTime = 4;
_enable_interrupt();
}
else
{
ALARM_SOUND_CANCLE();
}
}
}
void AlarmSoundCancle(void)
{
TempAlarmSound1 = _SysPotInfo.alarm_sound1;
TempAlarmSound2 = _SysPotInfo.alarm_sound2;
TempAlarmSound3 = _SysPotInfo.alarm_sound3;
if( LowVIStateWord & 0x07 )
{
if( _SysPotInfo.alarm_sound1 & BIT0 )
{
_SysPotInfo.alarm_sound1 &=~ BIT0;
}
}
if( LowVIStateWord & 0x70 )
{
if( _SysPotInfo.alarm_sound1 & BIT1 )
{
_SysPotInfo.alarm_sound1 &=~ BIT1;
}
}
if( AlarmCtlWord1 & ALARM_OF_ISEQERR )
{
if( _SysPotInfo.alarm_sound1 & BIT2 )
{
_SysPotInfo.alarm_sound1 &=~ BIT2;
}
}
if( AlarmCtlWord1 & ALARM_OF_DATA_FLASH )
{
if( _SysPotInfo.alarm_sound1 & BIT3 )
{
_SysPotInfo.alarm_sound1 &=~ BIT3;
}
}
if( PowerStateFlag & PS_LOWPOWER_FLAG )
{
if( _SysPotInfo.alarm_sound1 & BIT5 )
{
_SysPotInfo.alarm_sound1 &=~ BIT5;
}
}
if( AlarmCtlWord2 & ALARM_OF_CURIMBA )
{
if( _SysPotInfo.alarm_sound2 & BIT0 )
{
_SysPotInfo.alarm_sound2 &=~ BIT0;
}
}
if( AlarmCtlWord2 & ALARM_OF_OV_LOAD )
{
if( _SysPotInfo.alarm_sound2 & BIT1 )
{
_SysPotInfo.alarm_sound2 &=~ BIT1;
}
}
if( AlarmCtlWord2 & ALARM_OF_OV_REQ )
{
if( _SysPotInfo.alarm_sound2 & BIT2 )
{
_SysPotInfo.alarm_sound2 &=~ BIT2;
}
}
if( AlarmCtlWord2 & ALARM_OF_VSEQERR )
{
if( _SysPotInfo.alarm_sound2 & BIT3 )
{
_SysPotInfo.alarm_sound2 &=~ BIT3;
}
}
if( PhaseActive & BIT4 )
{
if( _SysPotInfo.alarm_sound2 & BIT4 )
{
_SysPotInfo.alarm_sound2 &=~ BIT4;
}
}
if( OverVIStateWord & 0x07 )
{
if( _SysPotInfo.alarm_sound3 & BIT0 )
{
_SysPotInfo.alarm_sound3 &=~ BIT0;
}
}
if( OverVIStateWord & 0x70 )
{
if( _SysPotInfo.alarm_sound3 & BIT1 )
{
_SysPotInfo.alarm_sound3 &=~ BIT1;
}
}
if( ( TempAlarmSound1 != _SysPotInfo.alarm_sound1 ) || ( TempAlarmSound2 != _SysPotInfo.alarm_sound2 )
|| ( TempAlarmSound3 != _SysPotInfo.alarm_sound3 ) )
{
_SysPotInfo.chksum = SysDoCheckSum( (unsigned char *)&_SysPotInfo.regv_con[0], sizeof(_sys_potinfo_s)-4 );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -