zml 发表于 2013-2-17 17:31:55

问个LPC1768串口发送中断标志的问题

本帖最后由 zml 于 2013-2-17 17:34 编辑

参考手册上说,
The UARTn THRE interrupt (UnIIR = 001) is a third level interrupt and is activated
when the UARTn THR FIFO is empty provided certain initialization conditions have been
met. These initialization conditions are intended to give the UARTn THR FIFO a chance to
fill up with data to eliminate many THRE interrupts from occurring at system start-up. The
initialization conditions implement a one character delay minus the stop bit whenever
THRE = 1 and there have not been at least two characters in the UnTHR at one time
since the last THRE = 1 event. This delay is provided to give the CPU time to write data to
UnTHR without a THRE interrupt to decode and service. A THRE interrupt is set
immediately if the UARTn THR FIFO has held two or more characters at one time and
currently, the UnTHR is empty.

没太看懂这段英文。

我做实验的结果是(9600,8,n,1),
单片机复位后如果不发送数据,就一直不发生THRE中断。
复位后只发送一个字符,发生一次THRE中断。
复位后连续发送16个字符,发送间隔900us,发生一次THRE中断。
复位后连续发送16不字符,发送间隔1100us,发生16次THRE中断。
复位后连续发生16个字符,发送间隔1000us,发生中断的次数有时3次,有时2次,次数开始不定。

问题是,手册上描述的 initialization conditions 条件到底是怎么回事?晕晕的。
另一个问题是,如果用UART0,2,3实现485通信,有可能实现吗?LPC1768这个片子在TSR(发送移位寄存器)为空时不发生中断。

jm2011 发表于 2013-2-19 16:49:53

同样关注,还有UnTHR 是什么寄存器?

zml 发表于 2013-2-20 09:55:33

THR是发送保持寄存器。 {:smile:}
页: [1]
查看完整版本: 问个LPC1768串口发送中断标志的问题