完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我使用所有5个EUSAT在18F67 K40,但我有麻烦使RX1工作。所有的EUSTART运行异步模式,速度设置为9600波特,1和4都使用PORTC。我已经在RX1和RX4之间交换了引脚来测试硬件。当EuSART4接收数据时,它工作得很好,所以它不是PIN配置或故障问题。TX1和TX4无论连接到哪一个引脚都工作良好。唯一不起作用的是RX1-我不能得到RC1IF标志来设置,因此它不能在数据中计时。在USAART1和EUSATAR4之间的配置是相同的,所以我不能想到RX1不起作用的任何理由。
以上来自于百度翻译 以下为原文 I use all 5 eusarts on 18f67k40 but am having trouble getting Rx1 to work. All eusarts run async mode with speed set to 9600 bauds on 1 and 4 which both use PortC. I have swapped pins between Rx1 and Rx4 to test the hardware. When eusart4 receives data it works fine so it isn't a pin configuration or fault problem. Tx1 and Tx4 work fine whichever pin they are connected to. The only thing that doesn't work is Rx1 - I cannot get the RC1IF flag to set so it cannot be clocking in data. The configuration is identical between eusart1 and eusart4 so I cannot think of any reason for Rx1 not to function. Does anyone with more experience of PIC eusarts have any suggestions please. |
|
相关推荐
10个回答
|
|
你能准备一个简单的独立应用程序来演示这个问题吗?也许你发现了一个硬件问题,或者你可能只是意外地做了一些其他的事情,比如关闭USAT。
以上来自于百度翻译 以下为原文 Can you prepare a simple standalone application that demonstrates the problem? Maybe you've found a hardware problem, or maybe you've just accidentally done something else, such as powering down that USART. |
|
|
|
谢谢你的建议——我做了一个小测试程序,RX1工作得很好!我已经开始把剩下的代码放进这个测试程序中,但是当我添加所有的变量——代码本身没有变化时,只要添加变量——它就停止工作了。我可以注释变量,直到我可以注释一个变量,它工作,取消注释,它停止工作。这些变量与活动代码无关,只是一个空间被放置的全局变量。数据使用率约为17%,明显小于RX1不工作的程序,这可能是一个单独的线程,但是这里发生了什么?除了RAM的大小之外,全局变量的数目是否有限制?在内存的特定部分需要做什么来定位变量吗?由于这是一个简单的微处理器,所有的变量都是全局变量。我知道的不是纯粹主义者,但应该有足够的空间为每个数据元素留出RAM,不必担心分配/去分配等。
以上来自于百度翻译 以下为原文 Thank you for the suggestion - I made a small test program and Rx1 works fine! I have started putting the rest of the code into this test program but when I add all the variables - no change to the code itself, just add variables - it stops working. I can comment out variables until I get to a point when I can comment out a variable and it works, uncomment it and it stops working. These variables have nothing to do with the active code - just a global variable for which space is being set aside. The data usage is about 17% which is significantly less than the program that works fine apart from Rx1 not working. Perhaps this should be a separate thread but what is going on here? Is there any limit to the number of global variables apart from the size of the RAM? Does anything need to be done to locate variables in specific parts of memory? As this is a simple microprocessor, all my variables are global. Not for purists I know but there should be enough space to set aside RAM for every data element and no need to worry about allocating/de-allocating etc. |
|
|
|
我们真的需要再说一遍吗?邮政编码显示的问题,使它尽可能小,仍然显示问题。使它完成,所以其他人可以编译和运行/测试。列出编译器版本等。
以上来自于百度翻译 以下为原文 Do we really need to say this again? Post code that exhibits the issues, make it as small as you can and still show the problem. Make it complete so someone else can compile and run/test. List your compiler version, etc. |
|
|
|
亲爱的杰克,有时运行的代码行不是一切!在这种情况下,一个简单的程序很好,正如我所说的。当我添加了很多其他的东西时,问题就出现了。我希望有人可能有类似的问题,并且可以说:“……我有类似的问题,它是……“我在论坛上遇到的大多数最好的答案都是来自别人的经验。
以上来自于百度翻译 以下为原文 Dear Jack, sometimes running lines of code isn't everything! As in this case, a simple program works fine - as I said. The problem comes when I add a lot of other stuff. I was hoping someone might have had a similar issue and could say "... I had a similar problem and it was ..." Most of the best answers I've come across on forums are from other people's experience |
|
|
|
|
|
|
|
这就是为什么我建议发布一个最小的例子来说明这个问题。你(OP)添加到“简单程序”中的东西是错误的,只有两种方法可以找到:你发布代码,有人尝试它,或者我们猜。我猜第172行有一个错误的指针引用。
以上来自于百度翻译 以下为原文 That is EXACTLY why I suggested posting the smallest example that shows the issue. Something you (the OP) added to the "simple program" is wrong and there are only two ways to find it: you post the code and someone tries it or we guess. My guess is line 172 has an incorrect pointer dereference. |
|
|
|
我要把我的耳环拿出来。”我有一个类似的问题,它是…“这个星球上没有人能提供答案或看到你的肩膀,看看你所看到的,甚至Bill Gates.Unbelievable。
以上来自于百度翻译 以下为原文 I'll just get my Orbuculum out. "... I had a similar problem and it was ..." No-one on this Planet could provide an answer or see over your shoulder as to what you are looking at, not even Bill Gates. Unbelievable. |
|
|
|
|
|
|
|
|
|
|
|
我发现了错误的地方,注意到RX1PPS寄存器不是代码中设置的值。通过步进PixMealth.C代码(MCC生成),我注意到Rx1ppsBist.Rx1PPS= 0x17所设置的0x17的Rx1PPS值;在执行T4InppsBist.t4IpPs= 0x21的情况下变成0x1;为什么这应该是我不知道的,但我认为它可能会帮助其他可怜的灵魂得到一个SIMIL。AR问题。我不再需要T4输入,所以我的问题就解决了。
以上来自于百度翻译 以下为原文 I've found what appears to be going wrong having noticed that the RX1PPS register was not the value set in the code. By stepping through the pin_manager.c code (generated by MCC) I noticed that the RX1PPS value of 0x17 set by RX1PPSbits.RX1PPS = 0x17; became 0x1 after execution of the line T4INPPSbits.T4INPPS = 0x21; why this should be I have no idea but I thought it might help some other poor soul who gets a similar problem. I don't need the T4 input any more so my problem is resolved. |
|
|
|
只有小组成员才能发言,加入小组>>
5244 浏览 9 评论
2035 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3214 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2261 浏览 5 评论
779浏览 1评论
673浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
599浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
683浏览 0评论
580浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 16:58 , Processed in 1.700481 second(s), Total 96, Slave 80 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号