完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
嗨,我是一个新手与微芯片PIC和我使用PIC16F1719在一个探险家8 DEV板与一个皮卡3。我试图做一些基本例程,如点亮LED当按下一个按钮,我注意到我只是不能察觉到一个信号RB0。我已经使用了PIC18F和这个MCU,A我必须编写代码:用PIC16,即使按下RB0按钮,PIC永远不会执行条件(我用断点保证)。我可以测量PIC引脚上的电压降,但是为什么我不能在PoBBITS.RB0上得到高电平?我错过了PIC16的东西吗?我会感谢任何帮助。
以上来自于百度翻译 以下为原文 Hi, I'm a rookie with Microchip PIC and I'm using a PIC16F1719 on an Explorer 8 dev board with a PicKit3. I was trying to do some basic routines such as lighting the LEDs when pressing a button and I noticed that I just couldn't perceive a signal on RB0. I've already used a PIC18F and with this MCU, all I had to code was: TRISBbits.RB0 = 1; LATB = 0x0; if (PORTBbits.RB0) { //do stuff } With the PIC16, even though I press the RB0 button, the PIC never executes the condition (I ensured with a breakpoint). I can measure a voltage drop on the PIC pin but why can't I get a high level on PORTBbits.RB0? Am I missing something with the PIC16? I'll be thankful for any help. |
|
相关推荐
6个回答
|
|
你把PIN转换成数字模式了吗?任何模拟能力的引脚都会在模拟模式下加电,如果你进行数字读取,它将被读取为零。你有责任在电源上写入适当的安塞尔寄存器。这都是在PIC数据表的I/O端口部分记录的。
以上来自于百度翻译 以下为原文 Have you switched the pin to digital mode? Any analog capable pin will power up in analog mode, and will read as zero if you do a digital read. It's your responsibility to write to the appropriate ANSELx registers upon power on. This IS all documented in the I/O port section of the PIC datasheet. |
|
|
|
看到数据页的第129页和第131页……DS400 01740BRTFM,在这么多的情况下,这样一个粗鲁但令人惊讶的合适的首字母缩写词。
以上来自于百度翻译 以下为原文 See pages 129 and 131 of the data sheet......DS40001740B RTFM, such a rude but amazingly appropriate acronym in so many cases. |
|
|
|
谢谢你的快速回复。可悲的是,我的问题不是来自输入模式。(实际上是RA5,我忘记设置数字输入模式),但即使在数字中,RB0也不变化。我正在查看调试模式中的SFRS,而PORTB具有与PORTA相同的状态,但没有以相同的方式响应。它甚至根本没有反应。这可能是探险家8的问题吗?为什么RA5会响应而不是RB0,即使它们具有相同的配置?
以上来自于百度翻译 以下为原文 Thank you for those quick replies. Sadly my issue doesn't come from an input mode. (Actually yes for RA5 I forgot to set the digital input mode) But even in digital, RB0 does not vary. I'm looking at the SFRs in debug mode and PORTB has the same state as PORTA but doesn't respond the same way. It does not even respond at all. Could it be an issue from the Explorer 8? Why would RA5 respond but not RB0 even though they have the same configuration? |
|
|
|
它仅仅是RB0吗?其他端口B引脚工作正常吗?接下来要做的是检查数据表中的PIN图,看看RB0上的其他函数是什么。在我身上跳出的第一件事就是ZCD。你确定你没有意外地启用它吗?在CONT2中有一点,在ZCD1CON寄存器中也有一点。
以上来自于百度翻译 以下为原文 Is it only RB0? Are the other port B pins working ok? The next thing you should do is examine the pin diagram in the datasheet, and see what the other functions are on RB0. The first thing that leaps out at me is the ZCD. Are you sure you haven't accidentally enabled it? There's a bit in CONFIG2, as well as in the ZCD1CON register. |
|
|
|
我建议在Explorer 8开发板用户指南(可以从Microchip下载)检查Explorer 8板的示意图。似乎有许多东西连接到RB0引脚,MYBE,这正影响着你得到的东西…
以上来自于百度翻译 以下为原文 I suggest checking the schematic of the explorer 8 board in the Explorer 8 Development Board User's Guide (which you can download from microchip). There appears to be a number of things connected to the RB0 pin, mybe that is affecting what you are getting... |
|
|
|
你们俩都是对的!我没有禁用ZCD,它被RB0搞乱了。现在很好,谢谢你。
以上来自于百度翻译 以下为原文 You were right both of you! I didn't disable ZCD and it messed with RB0. Now it works fine thank you truly. |
|
|
|
只有小组成员才能发言,加入小组>>
5250 浏览 9 评论
2037 浏览 8 评论
1958 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2266 浏览 5 评论
788浏览 1评论
680浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
609浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
685浏览 0评论
582浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 13:53 , Processed in 1.098016 second(s), Total 54, Slave 48 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号