完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我试着在PIC和ARDUNO之间进行串行通信。但PIC不会“读取”正确的价值。有人可以看看我的代码,看看有什么不对。是的,我已经检查了ARDUINO正在输出一个值。我把接收文件作为一个TXT文档而不是A.Inc,因为我不能把它作为一个包含文件在这里。希望你能找出答案。语言是在丹麦,所以如果你有任何问题,只要问或使用谷歌翻译:P.BTW PORTB被设置为8个LED显示值在二进制。BRG乔纳斯
EKSAMSENPROJEKT ASM(3.02 KB)-下载35次 以上来自于百度翻译 以下为原文 Hi. I've tried to serial communicate between this pic and arduino. But the pic wont "read" the value right. Can somebody take a look at my code to see whats wrong. And yes i have checked that arduino is outputting a value. I put the reciever file as a txt document instead of a .inc because I can't put it as an include file here. Hopefully you can figure it out anyway. The language is in danish so if you have any questions regarding, just ask or use google translate :P. Btw PORTB is set to be 8 LEDs to show the value in binary. brg Jonas Attachment(s) Reciever.txt (2.63 KB) - downloaded 29 times Eksamensprojekt.ASM (3.02 KB) - downloaded 35 times |
|
相关推荐
1个回答
|
|
我看到一些问题,但不是你的问题的原因。不要设置RCIE。这仅仅是为了产生中断,因为GIE没有被设置,所以你在逃避。如果设置了GIE,程序将崩溃,因为没有中断服务例程。RCIE不屏蔽RCIF位。停止尝试清除RCIF。那个位是只读的。唯一可以清除的方法是读取RCREG寄存器,这是你已经在做的。不要试图清除RCREG。那个寄存器是只读的,它到底在读什么吗?如果是,什么输入给出什么输出?是ARDUNO输出TTL串行,还是RS232串行?在ARDUNO和PIC之间有RS232缓冲吗?
以上来自于百度翻译 以下为原文 I see some things wrong, but not the cause of your problem. Do NOT set RCIE. That is only for generating interrupts. You are getting away with it because GIE is not set. If GIE was set, your program would crash because there is no interrupt service routine. RCIE does NOT mask the RCIF bit. Stop trying to clear RCIF. That bit is read-only. The ONLY way you can clear it is by reading the RCREG register, which you are already doing. Don't try to clear RCREG. That register is read-only. Is it reading anything at all? If yes, what input gives what output? Is the Arduino outputting TTL serial, or RS232 serial? Is there any sort of RS232 buffering between the Arduino and the PIC? |
|
|
|
只有小组成员才能发言,加入小组>>
5238 浏览 9 评论
2027 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3202 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
772浏览 1评论
662浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
590浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
672浏览 0评论
572浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 09:22 , Processed in 1.511076 second(s), Total 77, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号