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

📄 framemodule.c

📁 该程序完成了c8051外围电路的驱动和串口协议的编写。希望能给大家学习51单片机带来帮助
💻 C
📖 第 1 页 / 共 5 页
字号:
				{
					ReportAlertEvent(uchChannel,ENTERLOWDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x04)
				{
					ReportAlertEvent(uchChannel,QUITLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x0c)
				{
					ReportAlertEvent(uchChannel,QUITLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x01)		 //20080517
				{
					ReportAlertEvent(uchChannel,QUITLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x08)	  //20080517
				{
					ReportAlertEvent(uchChannel,QUITLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHDANGERALARM);
				}
			}
			else if (MainModule.uchLastChannelAlarm[uchChannel - 1] == 0x03)
			{
				if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x00)
				{
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);
					ReportAlertEvent(uchChannel,QUITLOWALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x02)
				{
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x04)
				{
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);
					ReportAlertEvent(uchChannel,QUITLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x0c)
				{	
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);
					ReportAlertEvent(uchChannel,QUITLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x01)
				{
					ReportAlertEvent(uchChannel,QUITLOWALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x08)
				{
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);
					ReportAlertEvent(uchChannel,QUITLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHDANGERALARM);
				}

			}
			else if (MainModule.uchLastChannelAlarm[uchChannel - 1] == 0x04)
			{
				if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x00)
				{
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x02)
				{
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x03)
				{
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x0c)
				{
					ReportAlertEvent(uchChannel,ENTERHIGHDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x01)
				{
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x08)
				{
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHDANGERALARM);
				}
			}
			else if (MainModule.uchLastChannelAlarm[uchChannel - 1] == 0x0c)
			{
				if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x00)
				{
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x02)
				{
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x04)
				{	
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x03)
				{
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x01)
				{
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x08)
				{
					ReportAlertEvent(uchChannel,QUITHIGHALERTALARM);
				}
			}
			else if (MainModule.uchLastChannelAlarm[uchChannel - 1] == 0x01)
			{
				if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x00)
				{
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);	
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x03)
				{
					ReportAlertEvent(uchChannel,ENTERLOWALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x02)
				{
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);
					ReportAlertEvent(uchChannel,ENTERLOWALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x04)
				{
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x08)
				{
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x0c)
				{
					ReportAlertEvent(uchChannel,QUITLOWDANGERALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHALERTALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHDANGERALARM);
				}
			}
			else if (MainModule.uchLastChannelAlarm[uchChannel - 1] == 0x08)
			{
			 	if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x00)
				{
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x02)
				{
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
					ReportAlertEvent(uchChannel,ENTERLOWALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x01)
				{
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
					ReportAlertEvent(uchChannel,ENTERLOWDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x03)
				{
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
					ReportAlertEvent(uchChannel,ENTERLOWALERTALARM);
					ReportAlertEvent(uchChannel,ENTERLOWDANGERALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x04)
				{
					ReportAlertEvent(uchChannel,QUITHIGHDANGERALARM);
					ReportAlertEvent(uchChannel,ENTERHIGHALERTALARM);
				}
				else if (MainModule.uchChannelAlarm[uchChannel - 1] == 0x0c)
				{
					ReportAlertEvent(uchChannel,ENTERHIGHALERTALARM);
				}
			}
		
			MainModule.uchLastChannelAlarm[uchChannel - 1] = MainModule.uchChannelAlarm[uchChannel - 1];
		}						
	}
	else
	{
		return;
	}		
}

//--------------------------------------------------------------------------------------------------
//函数名称:void JudgeAndReportCommonSystemEvenStatus(void)
//功    能:判断并上报一般系统事件,没有通道号
//输入参数:无
//返    回:无
//完成日期:4/16/2007
//--------------------------------------------------------------------------------------------------
void JudgeAndReportCommonSystemEvenStatus(void)
{
	unsigned char xdata uchTempValue;
	static unsigned char xdata s_uchCountData = 0;

	if (MainModule.uchStartReportTimeFlag == 1)			 //10秒之后进行系统事件的上报
	{
		if ((MainModule.uchEnableStatus[0] == 1) || (MainModule.uchEnableStatus[1] == 1))		//只要两个通道有一个Enable,就报系统事件
		{
			if (s_uchCountData == 1)   //判断两次上报一次
			{
				if (MainModule.uchPowerStatus == MainModule.uchPowerFlag)
				{
					;              //电源正常,不进行任何操作 ,否则进行状态判断并上报电源不正常状态
				}
				else
				{
					uchTempValue = MainModule.uchPowerStatus & 0x01;
					if (uchTempValue == 0x01)
					{
						ReportSystemEvent(0,SIGNALBOARDPOSITIVEFIVEVLAPSE);
					}
					uchTempValue = MainModule.uchPowerStatus & 0x02;
					if (uchTempValue == 0x02)
					{
						ReportSystemEvent(0,SIGNALBOARDPOSITIVEFIFTEENVLAPSE);
					}
					uchTempValue = MainModule.uchPowerStatus & 0x04;
					if (uchTempValue == 0x04)
					{
						ReportSystemEvent(0,SIGNALBOARDNEGATIVETWENTYFOURVLAPSE);
					}
					uchTempValue = MainModule.uchPowerStatus & 0x08;
					if (uchTempValue == 0x08)
					{
						ReportSystemEvent(0,SIGNALBOARDPOSITIVEFOURPOINTFIVEVLAPSE);
					}
					uchTempValue = MainModule.uchPowerStatus & 0x10;
					if (uchTempValue == 0x10)
					{
						ReportSystemEvent(0,SIGNALBOARDNEGATIVETWENTYTWOVLAPSE);
					}
					uchTempValue = MainModule.uchPowerStatus & 0x20;
					if (uchTempValue == 0x20)
					{
						ReportSystemEvent(0,SIGNALBOARDPOSITIVETHREEPOINTTHREEVLAPSE);
					}
					uchTempValue = MainModule.uchPowerStatus & 0x40;
					if (uchTempValue == 0x40)
					{
						ReportSystemEvent(0,SIGNALBOARDPOSITIVETHREEVLAPSE);
					}
				}
			
				MainModule.uchPowerFlag = MainModule.uchPowerStatus;
			
				if (MainModule.uchPhaseFlag == MainModule.uchPhaseLoseStatus)
				{
					;
				}
				else if (MainModule.uchPhaseLoseStatus == 0x01)
				{
					ReportSystemEvent(0,PHASELOST);
				}
			
				MainModule.uchPhaseFlag = MainModule.uchPhaseLoseStatus;
		
				if (MainModule.uchModuleFlagBAK == MainModule.uchModuleStatus)
				{
					;
				}
				else if (MainModule.uchModuleFlagBAK == 0x01)  
				{
					if (MainModule.uchModuleStatus == 0x02)
					{
						ReportSystemEvent(0,MODULEENTERCONFIGMODE);
					}
					else if (MainModule.uchModuleStatus == 0x03)
					{
						ReportSystemEvent(0,MODULEENTERTESTMODE);		
					}
					else if (MainModule.uchModuleStatus == 0x04)
					{
						ReportSystemEvent(0,MODULEENTERCALIBRATIONMODE);		
					}
				}
				else if (MainModule.uchModuleFlagBAK == 0x02)
				{
					if (MainModule.uchModuleStatus == 0x01)
					{
						ReportSystemEvent(0,MODULEENTERRUNMODE);
					}
					else if (MainModule.uchModuleStatus == 0x03)
					{
						ReportSystemEvent(0,MODULEENTERTESTMODE);		
					}
					else if (MainModule.uchModuleStatus == 0x04)
					{
						ReportSystemEvent(0,MODULEENTERCALIBRATIONMODE);		
					}
				}	
				else if (MainModule.uchModuleFlagBAK == 0x03)
				{
					if (MainModule.uchModuleStatus == 0x01)
					{
						ReportSystemEvent(0,MODULEENTERRUNMODE);
					}
					else if (MainModule.uchModuleStatus == 0x02)
					{
						ReportSystemEvent(0,MODULEENTERCONFIGMODE);		
					}
					else if (MainModule.uchModuleStatus == 0x04)
					{
						ReportSystemEvent(0,MODULEENTERCALIBRATIONMODE);		
					}
				}
				else if (MainModule.uchModuleFlagBAK == 0x04)
				{
					if (MainModule.uchModuleStatus == 0x01)
					{
						ReportSystemEvent(0,MODULEENTERRUNMODE);
					}
					else if (MainModule.uchModuleStatus == 0x02)
					{
						ReportSystemEvent(0,MODULEENTERCONFIGMODE);		
					}
					else if (MainModule.uchModuleStatus == 0x03)
					{
						ReportSystemEvent(0,MODULEENTERTESTMODE);		
					}
				}
						
				MainModule.uchModuleFlagBAK = MainModule.uchModuleStatus;		
			
				if (MainModule.uchRAMLostFlag == MainModule.uchRAMLostStatus)
				{
					;
				}	
				else if (MainModule.uchRAMLostStatus == 1) 
				{
					ReportSystemEvent(0,RAMLAPSE);
				}
			
				MainModule.uchRAMLostFlag = MainModule.uchRAMLostStatus;
			
				if (MainModule.uchFlashLostStatus == MainModule.uchFlashLostFlag)
				{
					;
				}
				else if (MainModule.uchFlashLostStatus == 1)
				{
					ReportSystemEvent(0,EEPROMORFLASHLAPSE);
				}
			
				MainModule.uchFlashLostFlag = MainModule.uchFlashLostStatus;
			
				if (MainModule.uchModuleNewConfigFlag == MainModule.uchModuleNewConfigStatus)
				{
					;
				}
				else if (MainModule.uchModuleNewConfigStatus == 0x01)

⌨️ 快捷键说明

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