No.31718 作者:rocfly 邮件:zhang2972@sohu.com ID:12455 登陆:2次 文章数:1篇 最后登陆IP:61.149.3.149 最后登陆:2003/5/28 10:27:57 注册:2003/5/23 20:47:56 财富:55 发帖时间:2003/5/23 20:50:45 发贴者IP:61.149.7.88 标题:rocfly:at91r40008,配置UART,发送数据正常,接收数据出现异常,详细见内 摘要:No.31718at91r40008,配置UART,发送数据正常,接收数据出现异常,详细见内 我用的是at91r40008,配置UART,发送数据正常,从超级终端向cpu写值的时候,在US_RHR寄存器有值,但是单步走的下一步的时候,程序就会进入异常中断,是 Undefhandler,死循环。我在写程序的时候将中断屏蔽掉,想着此cpu有PDC可以自己进行工作。不知道这样写是否正确,还有就是接收数据是不是一定得用到中断处理程序来做。谢谢,不吝赐教。 //* Define RXD and TXD as peripheral //* Define PIOs to be controlled by peripherals pio_pt-> pio_base-> PIO_PDR=0x600000; //配置PIO 寄存器使的TXD1 RXD1为串口 //* Reset receiver and transmitter 复位uart的Control Register usart_pt-> usart_base-> US_CR = US_RSTRX | US_RSTTX | US_RXDIS |US_TXDIS ; //* Clear Transmit and Receive Counters usart_pt-> usart_base-> US_RCR = 0 ; usart_pt-> usart_base-> US_TCR = 0 ; //* Define the baud rate divisor register usart_pt-> usart_base-> US_BRGR = speed ; ......
>>返回讨论的主题
|
老古网执行:16毫秒 最大:4266毫秒 查询6次
|
|