1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我在PIC32 MX250F256H控制器中遇到了奇怪的事情。我使用的是UPART驱动程序,它在PIC32 MX250F128D中工作得很好。U3Stest.UrxDA从来没有设置在PIC32 MX250F256H中。
以上来自于百度翻译 以下为原文 Hi , I have come across weird thing in PIC32MX250F256H controller.I am using UART driver which is working well in PIC32MX250F128D. U3STAbits.URXDA is never set in PIC32MX250F256H .void OpenUart3() { ANSELGbits.ANSG7=ANSELGbits.ANSG7=0; RPG8R |= (0X1<<0); U3RXR |= (0X1<<0); U3MODEbits.ON = 0; U3MODEbits.BRGH = 0;//STANDARD SPEED MODE U3MODEbits.STSEL = 0; //1 stop bit U3MODEbits.ABAUD = 0;//Disable auto baud rate U3STA |= (0<<14)|(0<<15); U3STA |= (0<<6)|(0<<7); // IEC2bits.U3TXIE = 1; // IEC1bits.U3RXIE = 1; INTCONbits.MVEC = 1;//Multi-VEctor interrupt eNABLE IPC9bits.U3IP=3; IPC9bits.U3IS=0; INTEnableInterrupts(); // enable interrupts U3STAbits.URXEN = 1;//RECEIVER ENABLE U3STAbits.UTXEN = 1;//TX ENABLE U3MODEbits.ON = 1;//ENABLE UART U3BRG = 32;//9600 BAUD RATE WITH WITH FPB CLK IS 5 MHz } void main(void) { OpenUart3(); while(1) { if(U3STAbits.URXDA) { //Read U3RXREG data } } } |
|
相关推荐
2个回答
|
|
昨天我也使用了MPLAB和声。同样的事情也在那里发生。
以上来自于百度翻译 以下为原文 Yesterday I used MPLAB harmony also.Same thing is happening there also.sad: |
|
|
|
真正地?嗯,我打赌你的问题在这里,但我没有检查什么是TX,什么是RXXY更多的评论从未尝试启用中断,如果你没有中断功能定义。目前部分评论,但它看起来危险。下一步请阅读您的手册DS601290E页204.URXEN和UTXEN A。只读取位。在页面的顶部,您有表寄存器19-2。您可以轻松阅读,哪些位是读或写或两者兼而有之,以及它们在电源开启后的默认值。[编辑:我纠正了我对RPG8R和U3RXR的解释]这是什么?右边评估为0x1。然而,您或这到寄存器中,它不使SENE.RPG8R=0x01//0x01是U3TXE将仅在零之前对RPG8R=0x01进行评估。幸运的是,电源接通后似乎是这样。U3RXR=(0x1&lt;lt;0);U3RXR=0x01//0x01相同的是RPG8-和gt;因此,如果RPG8应该是您的输入,那么您最好像这个ANSELGGBITS修复它。ANSG7= ANSELGBITS。ANSG8= 0这是什么?这些都是NOP,什么都不做,您在这些寄存器中维护0x000,而且它不是“人类可读的”,您应该为这些位使用适当的编译器定义。这也避免了这种类型的错误。你在别的地方做过,为什么不在这里呢?
以上来自于百度翻译 以下为原文 Really ? Well I bet your problem is here, but I did not check now what is TX and what is RX ANSELGbits.ANSG7=ANSELGbits.ANSG7=0; Several more comments Never try to enable interrupts, if you have no interrupt function defined. Currently partly commented out, but it looks dangerous. Next please read your manual DS60001290E-page 204. U3STAbits.URXEN = 1;//RECEIVER ENABLE U3STAbits.UTXEN = 1;//TX ENABLE URXEN and UTXEN are read only bits. At the top of the page you have the table REGISTER 19-2. You can easily read, which bits are Read or Write or both and also their defaults after power on. [edit: I have correctd my interpretation of RPG8R and U3RXR] What's this ? RPG8R |= (0X1<<0); U3RXR |= (0X1<<0); The right-hand side evaluates to 0x1. However you OR this into the registers, which does not make sense. RPG8R |= 0x01 // 0x01 is U3TX will evalute to RPG8R = 0x01 only if it was zero before. Luckily this seems to be the case after power on. U3RXR |= (0X1<<0); The same for U3RXR = 0x01 // 0x01 is RPG8 -> So if RPG8 should be your input, then you better fix it like this ANSELGbits.ANSG7=ANSELGbits.ANSG8=0 What's this ? U3STA |= (0<<14)|(0<<15); U3STA |= (0<<6)|(0<<7); These are NOPs and do nothing, you are ORing 0x0000 into these registers. Also it is not "human-readable", you should user the proper compiler definitions for these bits. This also avoids this type of error. You did that in other places, why not here. |
|
|
|
只有小组成员才能发言,加入小组>>
5238 浏览 9 评论
2028 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3204 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
777浏览 1评论
666浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
595浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
676浏览 0评论
576浏览 0评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 02:30 , Processed in 1.334348 second(s), Total 79, Slave 63 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号