STM32 串口中断方式例程

上传者: sdg1df68 | 上传时间: 2022-04-07 11:02:33 | 文件大小: 459KB | 文件类型: RAR
STM32 串口中断方式例程 /*---------------------------------------------------------------------------- USART1_IRQHandler Handles USART1 global interrupt request. *----------------------------------------------------------------------------*/ void USART1_IRQHandler (void) { volatile unsigned int IIR; struct buf_st *p; IIR = USART1->SR; if (IIR & USART_FLAG_RXNE) { // read interrupt USART1->SR &= ~USART_FLAG_RXNE; // clear interrupt p = &rbuf; if (((p->in - p->out) & ~(RBUF_SIZE-1)) == 0) { p->buf [p->in & (RBUF_SIZE-1)] = (USART1->DR & 0x1FF); p->in++; } } if (IIR & USART_FLAG_TXE) { USART1->SR &= ~USART_FLAG_TXE; // clear interrupt p = &tbuf; if (p->in != p->out) { USART1->DR = (p->buf [p->out & (TBUF_SIZE-1)] & 0x1FF); p->out++; tx_restart = 0; } else { tx_restart = 1; USART1->CR1 &= ~USART_FLAG_TXE; // disable TX interrupt if nothing to send } } }

文件下载

资源详情

[{"title":"( 56 个子文件 459KB ) STM32 串口中断方式例程","children":[{"title":"实验6-USART_Irq串口中断方式","children":[{"title":"说明.txt <span style='color:#111;'> 178B </span>","children":null,"spread":false},{"title":"Usart_Opt.Bak <span style='color:#111;'> 3.42KB </span>","children":null,"spread":false},{"title":"Usart.Opt <span style='color:#111;'> 3.55KB </span>","children":null,"spread":false},{"title":"STM32F10x.s <span style='color:#111;'> 11.04KB </span>","children":null,"spread":false},{"title":"Abstract.txt <span style='color:#111;'> 881B </span>","children":null,"spread":false},{"title":"STM32_Init.c <span style='color:#111;'> 301.57KB </span>","children":null,"spread":false},{"title":"JLinkLog.txt <span style='color:#111;'> 256.66KB </span>","children":null,"spread":false},{"title":"Usart_RAM.dep <span style='color:#111;'> 5.88KB </span>","children":null,"spread":false},{"title":"STM32_Init.c.bak <span style='color:#111;'> 301.58KB </span>","children":null,"spread":false},{"title":"STM32_Init.h <span style='color:#111;'> 1.16KB </span>","children":null,"spread":false},{"title":"Usart.Uv2 <span style='color:#111;'> 7.43KB </span>","children":null,"spread":false},{"title":"out","children":[{"title":"LstRAM","children":[{"title":"Usart.map <span style='color:#111;'> 47.92KB </span>","children":null,"spread":false}],"spread":true},{"title":"ObjSim","children":[{"title":"usart.sct <span style='color:#111;'> 479B </span>","children":null,"spread":false}],"spread":false},{"title":"LstFlash","children":[{"title":"Usart.map <span style='color:#111;'> 46.03KB </span>","children":null,"spread":false}],"spread":false},{"title":"LstSim","children":null,"spread":false},{"title":"ObjFlash","children":[{"title":"Usart.plg <span style='color:#111;'> 504B </span>","children":null,"spread":false},{"title":"retarget.d <span style='color:#111;'> 195B </span>","children":null,"spread":false},{"title":"stm32_init.d <span style='color:#111;'> 2.70KB </span>","children":null,"spread":false},{"title":"usart.o <span style='color:#111;'> 172.54KB </span>","children":null,"spread":false},{"title":"usart.d <span style='color:#111;'> 2.62KB </span>","children":null,"spread":false},{"title":"Usart.hex <span style='color:#111;'> 4.17KB </span>","children":null,"spread":false},{"title":"retarget.crf <span style='color:#111;'> 5.56KB </span>","children":null,"spread":false},{"title":"STM32F10x.o <span style='color:#111;'> 4.97KB </span>","children":null,"spread":false},{"title":"Usart.sct <span style='color:#111;'> 479B </span>","children":null,"spread":false},{"title":"Usart.axf <span style='color:#111;'> 23.30KB </span>","children":null,"spread":false},{"title":"stm32_init.o <span style='color:#111;'> 177.65KB </span>","children":null,"spread":false},{"title":"Usart.lnp <span style='color:#111;'> 406B </span>","children":null,"spread":false},{"title":"retarget.o <span style='color:#111;'> 11.02KB </span>","children":null,"spread":false},{"title":"usart.crf <span style='color:#111;'> 149.80KB </span>","children":null,"spread":false},{"title":"stm32_init.crf <span style='color:#111;'> 157.91KB </span>","children":null,"spread":false},{"title":"Usart.htm <span style='color:#111;'> 23.13KB </span>","children":null,"spread":false},{"title":"Usart.tra <span style='color:#111;'> 1.24KB </span>","children":null,"spread":false}],"spread":false},{"title":"ObjRAM","children":[{"title":"Usart.plg <span style='color:#111;'> 605B </span>","children":null,"spread":false},{"title":"retarget.d <span style='color:#111;'> 189B </span>","children":null,"spread":false},{"title":"stm32_init.d <span style='color:#111;'> 2.64KB </span>","children":null,"spread":false},{"title":"usart.o <span style='color:#111;'> 177.18KB </span>","children":null,"spread":false},{"title":"usart.d <span style='color:#111;'> 2.56KB </span>","children":null,"spread":false},{"title":"retarget.crf <span style='color:#111;'> 5.56KB </span>","children":null,"spread":false},{"title":"STM32F10x.o <span style='color:#111;'> 4.97KB </span>","children":null,"spread":false},{"title":"ExtDll.iex <span style='color:#111;'> 19B </span>","children":null,"spread":false},{"title":"Usart.sct <span style='color:#111;'> 479B </span>","children":null,"spread":false},{"title":"Usart.axf <span style='color:#111;'> 24.48KB </span>","children":null,"spread":false},{"title":"stm32_init.o <span style='color:#111;'> 181.78KB </span>","children":null,"spread":false},{"title":"Usart.lnp <span style='color:#111;'> 392B </span>","children":null,"spread":false},{"title":"stm32_init.__i <span style='color:#111;'> 273B </span>","children":null,"spread":false},{"title":"retarget.o <span style='color:#111;'> 14.96KB </span>","children":null,"spread":false},{"title":"usart.crf <span style='color:#111;'> 149.80KB </span>","children":null,"spread":false},{"title":"usart.__i <span style='color:#111;'> 253B </span>","children":null,"spread":false},{"title":"stm32_init.crf <span style='color:#111;'> 157.95KB </span>","children":null,"spread":false},{"title":"Usart.htm <span style='color:#111;'> 21.91KB </span>","children":null,"spread":false},{"title":"Usart.tra <span style='color:#111;'> 1.21KB </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"Usart.c <span style='color:#111;'> 5.76KB </span>","children":null,"spread":false},{"title":"Usart_Uv2.Bak <span style='color:#111;'> 7.43KB </span>","children":null,"spread":false},{"title":"RAM.ini <span style='color:#111;'> 1.23KB </span>","children":null,"spread":false},{"title":"STM32_Reg.h <span style='color:#111;'> 8.41KB </span>","children":null,"spread":false},{"title":"Retarget.c <span style='color:#111;'> 2.40KB </span>","children":null,"spread":false},{"title":"Usart_FLASH.dep <span style='color:#111;'> 5.81KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

  • sha_sha_smile :
    程序不错,可以借鉴
    2014-05-15
  • william_linan :
    非常好! stm32,keil工程。串口中断处理,有代表性。收和发都中断方式,包含printf等库函数重定向。
    2014-02-25

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明