外部中断函数
void KEY_UP_IRQHandler(void)
{
if (EXTI_GetITStatus(KEY_UP_INT_EXTI_LINE) != RESET) //确保是否产生了EXTI Line 中断
{
Usart_SendByte( DEBUG1_USART,modbus.myadd);//发送从机数据
Usart_SendByte( DEBUG1_USART,0x03);
Usart_SendByte( DEBUG1_USART,0x00);
Usart_SendByte( DEBUG1_USART,0x00);
Usart_SendByte( DEBUG1_USART,0x00);
Usart_SendByte( DEBUG1_USART,0x02);
Usart_SendByte( DEBUG1_USART,0xC4);
Usart_SendByte( DEBUG1_USART,0x5E);
Usart_SendByte( DEBUG_USART,modbus.myadd);//发送到新开的串口用于调试查看
Usart_SendByte( DEBUG_USART,0x03);
Usart_SendByte( DEBUG_USART,0x00);
Usart_SendByte( DEBUG_USART,0x00);
Usart_SendByte( DEBUG_USART,0x00);
Usart_SendByte( DEBUG_USART,0x02);
Usart_SendByte( DEBUG_USART,0xC4);
Usart_SendByte( DEBUG_USART,0x5E);
EXTI_ClearITPendingBit(KEY_UP_INT_EXTI_LINE); //清除中断标志位
}
}
|