/** ****************************************************************************** * @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.c * @author MCD Application Team * @version V1.8.0 * @date 04-November-2016 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * *

© COPYRIGHT 2016 STMicroelectronics

* * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx_it.h" #include "basic.h" int it_100us_flag = 0; //100us��ʱ��־ int it_100us_cnt = 0; int it_500us_flag = 0; //100us��ʱ��־ int it_500us_cnt = 0; int it_1ms_flag = 0; //1ms��ʱ��־ int it_1ms_cnt = 0; int it_50ms_flag = 0; //10ms��ʱ��־ int it_50ms_cnt = 0; int it_100ms_flag = 0; //100ms��ʱ��־ int it_100ms_cnt = 0; int it_500ms_flag = 0; //300ms��ʱ��־ int it_500ms_cnt = 0; int it_1s_flag = 0; //1s��ʱ��־ int it_1s_cnt = 0; int time_cnt = 0; int x = 0; extern void TimingDelay_Decrement(void); //定时器3中断 void TIM3_IRQHandler(void) { if(TIM_GetITStatus(TIM3,TIM_IT_Update) != RESET) { it_100us_cnt++; if(it_100us_cnt >= 1) { it_100us_flag = 1; it_100us_cnt = 0; //检查时间测试标志 if(get_time_flag == 2) { if(time_cnt >= 2)//延时3s get_time(); } } it_500us_cnt++; if(it_500us_cnt >= 5) { it_500us_flag = 1; it_500us_cnt = 0; } it_1ms_cnt++; if(it_1ms_cnt >= 10) { it_1ms_flag = 1; it_1ms_cnt = 0; } it_50ms_cnt++; if(it_50ms_cnt >= 500) { it_50ms_flag = 1; it_50ms_cnt = 0; //检查频率测试标志 if(Mode_Flag == 3) { //光电开关变换频率 count_array[N] = count; count_sum += count_array[N]; count = 0; //ADC变换频率 ADC_Count_array[N] = ADC_Count; ADC_Count_sum += ADC_Count_array[N]; ADC_Count = 0; N++; //取20次总和 if(N>=20) { MOT_Fre = count_sum; ADC_Fre = ADC_Count_sum; N = 0; count_sum = 0; ADC_Count_sum = 0; } } } it_100ms_cnt++; if(it_100ms_cnt >= 1000) { it_100ms_flag = 1; it_100ms_cnt = 0; } it_500ms_cnt++; if(it_500ms_cnt >= 5000) { it_500ms_flag = 1; it_500ms_cnt = 0; } it_1s_cnt++; if(it_1s_cnt >= 10000) { //时间测试计时 if(get_time_flag == 2) time_cnt++; //依次断开ADC else if(get_time_flag == 3) { time_cnt = 0; GPIO_ResetBits(GPIOF,GPIO_Pin_11); //断开 get_time_flag = 2; } it_1s_flag = 1; it_1s_cnt = 0; } TIM_ClearITPendingBit(TIM3,TIM_IT_Update); } } //串口1中断 void USART1_IRQHandler(void) { if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) //�����ж� { unsigned char ch = 0; ch = USART_ReceiveData(USART1); //printf("%c",ch); receive_ttl_data(ch); //USART_ClearFlag(USART1, USART_FLAG_RXNE); } } //�жϻ��洮������ //#define UART_BUFF_SIZE 10 //int buf_flag = 0; //volatile uint16_t uart_p = 0; //uint8_t uart_buff[UART_BUFF_SIZE]; void USART3_IRQHandler(void) //����3�жϷ������ { if(USART_GetFlagStatus(USART3, USART_FLAG_IDLE) == SET) { DealWith_UartData(); get_length(com3_rx_buffer); USART3->SR; USART3->DR; //��USART_IT_IDLE��־ //USART_ReceiveData(USART3); //��������жϱ�־λ�����պ��������־λ�����ã� } } //外部IO中断,对应频率测试光电开关 void EXTI9_5_IRQHandler(void) { //ȷ���Ƿ������EXTI Line�ж� if(EXTI_GetITStatus(EXTI_Line6) != RESET) { count++; //����жϱ�־λ EXTI_ClearITPendingBit(EXTI_Line6); } } /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) { } } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler(void) { /* Go to infinite loop when Memory Manage exception occurs */ while (1) { } } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler(void) { /* Go to infinite loop when Bus Fault exception occurs */ while (1) { } } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler(void) { /* Go to infinite loop when Usage Fault exception occurs */ while (1) { } } /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) { } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler(void) { } /** * @brief This function handles PendSVC exception. * @param None * @retval None */ void PendSV_Handler(void) { } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) { TimingDelay_Decrement(); } /******************************************************************************/ /* STM32F4xx Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32f4xx.s). */ /******************************************************************************/ /** * @brief This function handles PPP interrupt request. * @param None * @retval None */ /*void PPP_IRQHandler(void) { }*/ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/