完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在做一个遗留项目,最初使用PIC16C63A,并被移植到PIC16F72。这是给客户的,我这里没有硬件,所以我把代码放在一起,我认为可以工作,然后把HEX文件发给他。由于WDT,第一个版本将每隔几秒钟重置,所以我在主循环中添加了一个CLRWDT,解决了这个问题。但是在RA0-RA3上有一个BCD显示器,它读取零而不是应该读取的1..9。我意识到这些引脚的ADC功能缺省是打开的,所以我设置ADCON1=0x07,应该使这些引脚数字化。我也有TrISA=0x10(对于RA4上的数字输入)。但是在模拟器中,RA0 RA3位即使在文件寄存器对话框中直接设置时也不会保持一个值。我认为模拟器是错误的,但在这一点上,我没有办法编程设备和测试它。我用PIC16F872做了一个项目,它和引脚兼容,并且工作正常。
以上来自于百度翻译 以下为原文 I am working on a legacy project that originally used a PIC16C63A and is being ported to a PIC16F72. This is for a customer and I don't have the hardware here, so I put together code that I thought would work and emailed the HEX file to him. The first version would reset every few seconds because of the WDT, so I added a CLRWDT in the main loop which fixed that problem. But there is a BCD display on RA0-RA3 and it read zero instead of 1..9 as it should have. I realized that the ADC function for these pins is on by default, so I set ADCON1 = 0x07 which should make these pins digital. I also have TRISA = 0x10 (for a digital input on RA4). But in the simulator the RA0-RA3 bits will not hold a value even when set directly in the File Registers dialog box. I think the simulator is faulty, but at this point I have no way to program a device and test it. I made another project using a PIC16F872 which is pin compatible, and it works as it should. [cross posted from 8 bit devices forum] |
|
相关推荐
2个回答
|
|
只是一个疯狂的想法。尝试写0x07地址0x9C。这是其他PIC中的CMCON寄存器(例如,PIC16F877),也可以将这些管脚放入模拟模式。您的PIC不应该有这个寄存器,但是可能存在模拟器错误。
以上来自于百度翻译 以下为原文 Just a crazy idea. Try writing 0x07 to address 0x9C. This is the CMCON register in some other PICs (e.g. PIC16F877), and can also put those pins into analog mode. Your PIC should not have that register, but a simulator bug might be implementing it. |
|
|
|
模拟器是错误的。努力修理它。工作是将ADCON1设置为5。(模拟器有一个600行交换机语句来处理各种16F设备上的解码ADCON1)!
以上来自于百度翻译 以下为原文 Simulator is wrong. Working on fixing it. Work-around is to set ADCON1 to 5. (The simulator has a 600 line switch statement to handle decoding ADCON1 across the various 16F devices!) |
|
|
|
只有小组成员才能发言,加入小组>>
5238 浏览 9 评论
2028 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3204 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
777浏览 1评论
666浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
595浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
676浏览 0评论
576浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 04:22 , Processed in 1.171147 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号