interrupt.c 3.39 KB
#include "includes.h"
#include "hardware.h"
#include "all_value.h"

//u8 handnum_t=0;
///******************************************************************
//定时器中断服务程序
//*******************************************************************/
////定时器3中断服务函数
void TIM3_IRQHandler(void)
{
	if(TIM_GetITStatus(TIM3,TIM_IT_Update)==SET) 
	{		
		if (TIM3_Mode1Nums<65535)TIM3_Mode1Nums++;
		if (TIM3_CanSend1Nums<255)TIM3_CanSend1Nums++;
		
		if (Tim3_XCNums[0]<255)Tim3_XCNums[0]++;

	}
	TIM_ClearITPendingBit(TIM3,TIM_IT_Update);  
}
////定时器4中断服务函数
void TIM4_IRQHandler(void)
{
	

	
	if(TIM_GetITStatus(TIM4,TIM_IT_Update)==SET) 
	{	
		u8 i;
		if (TIM4_Flash1Nums<255)TIM4_Flash1Nums++;	
		if (TIM4_Flash2Nums<255)TIM4_Flash2Nums++;
		if (TIM4_Flash3Nums<255)TIM4_Flash3Nums++;
		if (TIM4_Flash4Nums<255)TIM4_Flash4Nums++;
		if (TIM4_CanSend1Nums<255)TIM4_CanSend1Nums++;
		if (TIM4_Usart2Nums<255)TIM4_Usart2Nums++;		
		if (TIM4_USART5_SendNums<255)TIM4_USART5_SendNums++;
		if (CCD_M[0].Tim4_Usart56Nums<255)CCD_M[0].Tim4_Usart56Nums++;
		if (CCD_M[1].Tim4_Usart56Nums<255)CCD_M[1].Tim4_Usart56Nums++;
		if (TIM4_TouchSendNums<255)TIM4_TouchSendNums++;
		if (Tim4_Music1Nums<255)Tim4_Music1Nums++;



		if (Tim4_Slam1Nums<255)Tim4_Slam1Nums++;
		if (Tim4_Slam2Nums<255)Tim4_Slam2Nums++;
		if (TLaRadarDelay_Time4Nums<255)TLaRadarDelay_Time4Nums++;
		if (Tim4_AccDccNums<65535)Tim4_AccDccNums++;
		if (TIM4_WaitConUpNums<255)TIM4_WaitConUpNums++;
		if (TIM4_WaitConDownNums<255)TIM4_WaitConDownNums++;

		for(i=0;i<MaxMotNums;i++)
		{ 
			if (Motor[i].MToPc.Tim4_NodeProNums<255)Motor[i].MToPc.Tim4_NodeProNums++;
			if (Motor[i].MToPc.Tim4_AxisDelayNum<255)Motor[i].MToPc.Tim4_AxisDelayNum++;
		}		

	}
	TIM_ClearITPendingBit(TIM4,TIM_IT_Update);  
}

////定时器5中断服务函数
void TIM5_IRQHandler(void)
{
	if(TIM_GetITStatus(TIM5,TIM_IT_Update)==SET) 
	{
			if (Tim5_Hand1Nums<255)Tim5_Hand1Nums++;
			if (TIM5_FanNums<255)TIM5_FanNums++;
			if (TIM5_ElectrifyNums<255)TIM5_ElectrifyNums++;
		
			if (AGV.Charge_Time5Nums<255)AGV.Charge_Time5Nums++;
			if (AGV.AllAct_Time5Nums<255)AGV.AllAct_Time5Nums++;
  		if (MotorStopMiss_Time5Nums<255)MotorStopMiss_Time5Nums++;
			if (AGV.Rotation_Time5Nums<255)AGV.Rotation_Time5Nums++;
			if (Tim5_Slam3Nums<255)Tim5_Slam3Nums++;
			if (Tim5_PDNums<255)Tim5_PDNums++;
//			if (TLaRadarMiss_Time5Nums<255)TLaRadarMiss_Time5Nums++;
 			if (Tim5_TCP1Nums<255)Tim5_TCP1Nums++;
 			if (Tim5_Music2Nums<255)Tim5_Music2Nums++;
		 	if (Tim5_SystemTimeNums<65535)Tim5_SystemTimeNums++;
			if (Tim5_Battery1Nums<255)Tim5_Battery1Nums++;
	}
	TIM_ClearITPendingBit(TIM5,TIM_IT_Update); 
}

////定时器7中断服务函数
void TIM7_IRQHandler(void)
{
if(TIM_GetITStatus(TIM7,TIM_IT_Update)==SET)
	{
//		u8 i;
		 if (Tim7_NotKeyNums<255)Tim7_NotKeyNums++;
		 if (AGV.Line_Time7Nums<255)AGV.Line_Time7Nums++;	
		 if (Tim7_TaskDelayNums<255)Tim7_TaskDelayNums++;		
		 if (AGV.Time7_NotActNums<255)AGV.Time7_NotActNums++;		
		
	}
	TIM_ClearITPendingBit(TIM7,TIM_IT_Update);
}



/*************************CAN中断服务程序*****************************************/
#if CAN1_RX0_INT_ENABLE	//使能RX0中断
//中断服务函数		  

void CAN1_RX0_IRQHandler(void)
{
 CanRxMsg RxMessage;

		
	OSIntEnter();
	memset(&RxMessage,0,sizeof(RxMessage));

	
	CAN_Receive(CAN1, 0, &RxMessage);
	AxisData_Analysis(&RxMessage);
	BatteryData_Ananlysis(&RxMessage);
	MusicData_Analysis(&RxMessage);
	SlamPos_Ananlysis(&RxMessage);

	
	OSIntExit(); 
}
#endif