UART通信程序_中断方法.docVIP

  • 6
  • 0
  • 约小于1千字
  • 约 6页
  • 2020-04-10 发布于湖北
  • 举报
通信参数设置 void UART0_Init(void{ uint16 Fdiv; PINSEL0 = 0 U0LCR = 0x83; Fdiv = (Fpclk / 16 / 9600; U0DLM = Fdiv / 256; U0DLL = Fdiv % 256; U0LCR = 0x03; } UART中断设置 中断设置 void UART0_INT_Init(void{ U0IER=3; U0FCR=1; VICIntSelect=0; VICVectCntl0=0x20|6; VICVectAddr0=(intUART0_ISR; VICIntEnable=16; } void __irq UART0_ISR({ if (int_flag==2 { if (send_pointer=10 int int_flag; int_flag=U0IIR0x0f; { send_pointer++; UART0_SendByte(rebuf[send_pointer]; } else { send_pointer=0; } } if(int_flag==4 { rebuf[re_pointer]=U0RBR; if (re_pointer=10 { UART0_SendByte(rebuf[0]; re_pointer=0; } } VICVectAdd

文档评论(0)

1亿VIP精品文档

相关文档