完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,第一次在这里,第一次使用PIC单片机,我选择了PIC16F88。我有2个主要问题:1)当禁用MCLRn重置时,我仍然不能使用该PIN作为输出,正如您在MPLABYBD.PNG图片中看到的那样:从软件调试中,它自动调用TrISA=0x20,而不是想要的0x00(在MPLAN。PNG中的代码),其中位RA5(RA 76543210=0010)。0000=0x20是共享MCLRN输入的一个。这是由proteus仿真(Proteus PNG)所证实的,你可以看到RA 5是浮动的(灰色)。在调试期间,该寄存器是否存在于表SFR中?我找不到它。2)调试器似乎给出错误的值。看波尔塔:它配置为0xFF,但调试器显示0x80(而PORTB很好)。Proteus无论如何都给出正确的值(除了RA5我在1发言)。OsCon寄存器似乎是错误的,但是可能是由于某种原因设置的比特(它是iOFS:ItoSc频率稳定位)。谢谢。
以上来自于百度翻译 以下为原文 Hello everyone, first time here and first time using a PIC microcontroller, I chose a PIC16F88. I have 2 main issues: 1) When disabling the MCLRn reset (#pragma config MCLRE = OFF ) I still cannot use that pin as an output as you can see in the mplab_deb.png picture: from software debugging it autosets TRISA=0x20 instead of the wanted 0x00 (code in mplan.png), where bit RA5 (RA 76543210 = 00100000 = 0x20) is the one which shares the MCLRn input. This is confirmed by a proteus simulation (proteus.png), you can see the RA 5 is floating (grey color). [Is there a way to access the configuration bit register manually instead of the #pragma lines anyways? And is that register present among the watches SFR while debugging? I can't find it.] 2) The debugger seems to give wrong values. Look at PORTA: it is configured as 0xff but the debugger shows 0x80 (while PORTB is fine). Proteus gives right values anyways (except for RA5 I spoke in 1). Also the OSCCON register seems wrong, but maybe the set bit is there for some reason (it's the IOFS: INTOSC Frequency Stable bit). Thanks in advance. Attached Image(s) |
|
相关推荐
4个回答
|
|
我想知道你是否看过这本手册。
以上来自于百度翻译 以下为原文 I wonder if you have read the fine manual Attached Image(s) |
|
|
|
谢谢!我深深地在数据表线中说:“RA5/MCLR/VPP引脚可以配置为MCLR(默认),或者作为I/O引脚(RA5)。”忘记首页的指示。它说I/O,所以我也假设了。模拟的明显错误的值是什么?
以上来自于百度翻译 以下为原文 Thanks! I was deep in the datasheet lines where it says "The RA5/MCLR/VPP pin can be configured for MCLR (default), or as an I/O pin (RA5)." forgetting about the front page indications. It said I/O so I assumed O as well. What about the apparently wrong values of the simulation? |
|
|
|
对于第一个问题,请在数据表页14(和52)中阅读注释3。RA5只是一个输入;TrISA5位的状态没有影响,并且总是读取“1”。如果你提出了“I/O引脚”窗口(Window & Gt;模拟器-GT;IOPin)并观察PIN RA5,那么如果你没有“Y-PrimaMigReMigReClRe= off”,你就会看到MCLR是PIN拥有者,如果你添加了这个配置,RA5将是PIN拥有者。顺便说一下,有一个“配置位”窗口(Window & Gt;目标内存视图-gt;配置位),您可以手动访问配置位寄存器。对于第二个问题,我认为您的RA0、1, 2, 3、4和6引脚是模拟的,这就是为什么PORTA不为那些位设置。T,模拟器以不同的方式处理OSC外围设备,因此它的行为可能与实际设备上的不同。
以上来自于百度翻译 以下为原文 For your first issue, please read note 3 in the datasheet page 14 (and 52). "RA5 is an input only; the state of the TRISA5 bit has no effect and will always read ‘1’." The config MCLRE does work correctly. If you bring up the "I/O Pins" window (window->Simulator->IOPin) and observe pin RA5, you will see MCLR is the pin owner if you don't have the "#pragma config MCLRE = OFF" and RA5 will be the pin owner if you add that configuration. By the way, there is a "Configuration Bits" window (window->Target Memory Views->Configuration Bits) that you can access the configuration bit register manually. For you second issue, I think your RA0, 1, 2, 3, 4, and 6 pins are analog, that is why the PORTA is not setting for those bits. At last, the Simulator handles the OSC peripheral differently, so it might behave differently than what you see on a real device. |
|
|
|
非常感谢,你把一切都包括在内了。IOPin tab很棒,是的RAO-4是模拟的,我不知道PoTA在模拟中只显示数字值!
以上来自于百度翻译 以下为原文 Thanks a lot, you covered it all. The IOPin tab is great and yes RA0-4 are analog, I didn't know PORTA displays only digital values in simulation! |
|
|
|
只有小组成员才能发言,加入小组>>
4899 浏览 9 评论
1863 浏览 8 评论
1808 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3006 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2092 浏览 5 评论
500浏览 1评论
357浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
407浏览 0评论
297浏览 0评论
1053浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-6-26 12:48 , Processed in 1.052243 second(s), Total 83, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191