完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,所有,我用一个真正的冰系统设置一个PIC18F14K22连续发送“A”在1秒的时间间隔。这是因为我可以在我的范围内捕捉角色。当试图在第二张照片上接收到这个问题时,问题就出现了。两者都使用相同的波特率编码,并且以公共地球运行在5V。我的代码是:在1200 BaDCrRF SPBRGHVMOWLW D‘51’MOVWF SPBRG;BAUD=1200,4MHz SCORALBCF TXSTA,BRGBCF BUDCON,BRG16BCF TXSTA,同步;现在有同步=0,BRGH=0,BRG16= 0BSF RCSTA,SPEN;启用串行PORTBSF TRISB,RX;使RX PIN CF RPCSTA RCSTA,CRENBSF RCSTA,CREN;启用接收环1BTFSS PIR1,RCIF;HybRA Loop1MOVF RCREG的投票RCIF,WNOpenDI采用了正在发送“A”字符的PIC,并将其连接到一个最大值,它使用一个PIC32 MX170,它在船上有一个基本的解释器。这收到了“A”。这使我相信问题是在接收端。当我尝试接收角色时,我做了什么错事?谢尔辛扎
以上来自于百度翻译 以下为原文 Hi all, I used a Real Ice system to set one PIC18F14K22 to continuously transmit an 'A' at 1 second intervals. This worked as I can capture the character on my scope. The problem arises when trying to receive this on the second PIC. Both use the same baud rate code and are running at 5V with a common earth. My code is: ;Receive byte at 1200 baud CLRF SPBRGH MOVLW D'51' MOVWF SPBRG ;Baud=1200, 4MHz crystal BCF TXSTA,BRGH BCF BAUDCON,BRG16 BCF TXSTA,SYNC ;now have SYNC=0, BRGH=0,BRG16=0 BSF RCSTA,SPEN ;enable serial port BSF TRISB,RX ;make RX pin an input BCF RCSTA,CREN BSF RCSTA,CREN ;enable reception Loop1 BTFSS PIR1,RCIF ;poll RCIF for high BRA Loop1 MOVF RCREG,W NOP END I took the PIC that was transmitting the 'A' character and connected it to a Maximite which uses a PIC32MX170 which has a Basic interpreter on board. This received the 'A' . This convinces me that the problem is at the receiving end. What am I doing wrong when trying to receive a character? Thanks Hintza |
|
相关推荐
3个回答
|
|
你需要处理接收器上的UART错误。你还需要在接收器上连续循环,“第一次运行”永远不会在MCU上工作:
以上来自于百度翻译 以下为原文 You need to handle USART errors at the receiver. You also need a continous loop at the receiver, "first run" never works on MCUs :) |
|
|
|
嗨,达里奥,谢谢你的建议。你提到我需要在接收器上连续循环-我有一个连续监视RCIF标志的循环,而另一个PIC不断传输字符。如果没有接收到字符,我不知道如何监视UART错误。
以上来自于百度翻译 以下为原文 Hi Dario, Thanks for your suggestions. You mention that I need a continuous loop at the receiver - I have a loop which continuously monitors the RCIF flag and the other PIC is continuously transmitting a character. I'm not sure how to monitor USART errors if a character is not being received. Hintza |
|
|
|
搜索这个论坛,你会发现有关ORR和FER标志的代码。此外,你可能需要将输入引脚设置为数字(相对于模拟),如上面所建议的…
以上来自于百度翻译 以下为原文 Search this forum, you'll find code concerning OERR and FERR flags. Also, you possibly have to set your input pin as digital (vs. analog) as suggested above... |
|
|
|
只有小组成员才能发言,加入小组>>
5248 浏览 9 评论
2037 浏览 8 评论
1957 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2265 浏览 5 评论
788浏览 1评论
679浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
608浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
685浏览 0评论
582浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 08:55 , Processed in 1.392379 second(s), Total 81, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号