完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,第一次使用PIC单片机,我选择了PIC16F88。我有2个主要问题:1)当禁用MCLRn重置时,我仍然不能使用该PIN作为输出,正如您在MPLABYBD.PNG中所看到的:它自动调用TrISA=0x20,而不是所需的0x00,其中位RA5(RA 76543210=00100000=0x20)是共享MCLRN输入的一个。这是由proteus仿真(Proteus PNG)所证实的,你可以看到RA 5是浮动的(灰色)。仿真中的手表在哪里呢?2)调试器仿真似乎给出了错误的值。看波尔塔:它被配置为0xFF(MPLA.PNG),但是调试器显示0x80(而PORTB很好)。Proteus无论如何都给出了正确的值。OsCon寄存器似乎是错误的,但是可能设置的位由于某种原因被自动设置(它是IOFS:ItoSoc频率稳定位)。
以上来自于百度翻译 以下为原文 Hello everyone, 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 mplab_deb.png: it autosets TRISA=0x20 instead of the wanted 0x00, 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 where is this register among the watches in the simulation?] 2) The debugger simulation seems to give wrong values. Look at PORTA: it is configured as 0xff (mplab.png) but the debugger shows 0x80 (while PORTB is fine). Proteus gives right values anyways. Also the OSCCON register seems wrong, but maybe the bit which is set is automatically set for some reason (it's the IOFS: INTOSC Frequency Stable bit). Attached Image(s) |
|
相关推荐
2个回答
|
|
|
|
|
|
对于第一个问题,请在数据表页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. |
|
|
|
只有小组成员才能发言,加入小组>>
5248 浏览 9 评论
2036 浏览 8 评论
1956 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2264 浏览 5 评论
786浏览 1评论
677浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
603浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
684浏览 0评论
581浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 11:23 , Processed in 1.186061 second(s), Total 48, Slave 42 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号