完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
void USART3_Send_Byte(unsigned char ucSend_Data)
{ USART_SendData(USART3, ucSend_Data); while(USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET); } 一直在 while(USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET);死循环,不能进串口的中断。 中断这样配置对不? /************************************************************ 函数名: NVIC_Config** 功能描述: 中断分组及优先级配置** 输入参数: 无** 输出参数: 无***********************************************************/void NVIC_Config(void){ NVIC_InitTypeDef NVIC_InitStructure; NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); /*定时器3中断 */ NVIC_InitStructure.NVIC_IRQChannel = tiM1_CC_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = TIM4_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn; //通道设置为串口1中断(故后面应选择在“void USART1_IRQHandler(void)”开中断) NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; //中断占先等级0 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //中断响应优先级0 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //打开中断 NVIC_Init(&NVIC_InitStructure);} |
|
相关推荐
2个回答
|
|
while(USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET);
USART_SendData(USART3, c); 先判断然后再发送 |
|
|
|
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
飞凌嵌入式ElfBoard ELF 1板卡-CAN编程示例之开发板测试
352 浏览 0 评论
该问题是用APP给芯海科技的CST92F25芯片发指令是出现的
2085 浏览 1 评论
696 浏览 0 评论
1433 浏览 1 评论
2174 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-20 01:27 , Processed in 0.559649 second(s), Total 78, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号