完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我的环境:DSPIC33 FJ128GP708A,MPLABX V3.51,ICD3I已经简化了我的问题代码只有几行:如果引脚没有连接到它,它应该读取“1”,因为内部上拉。调试时效果良好。但是当PIC独立运行时,它会读取“0”。PIC用3.3V供电,用我的范围(1MOHM)和我的万用表(10MOHM)测量的电压大约是2.5V。首先我想知道为什么我不测量更高的电压。第二,我想知道为什么它只有调试时才能工作。谢谢任何帮助。丹
以上来自于百度翻译 以下为原文 Hello, my environment: dsPIC33FJ128GP708A, MPLABX v3.51, ICD3 I have simplified my problem code to just a few lines: AD1PCFGL = 0xFFFF; // All IO = Digital TRISBbits.TRISB15 = 1; // RB15 = Input CNPU1bits.CN12PUE = 1; // Weak Pull-Up enabled on RB15 while(1){ long int h; for (h=0; h < 500000; h++){ Nop(); } if (0 == PORTBbits.RB15){ UARTPutString("rnRB15 = 0rn"); } else{ UARTPutString("rnRB15 = 1rn"); } } If the pin has nothing connected to it, it should read '1', because of the internal pull-up. That works fine when debugging. But when the PIC runs in standalone, it reads '0'. The PIC is powered with 3.3V. The voltage I measure with my scope (1Mohm) and with my multimeter (10Mohm) is about 2.5V. First I wonder why I don't measure a higher voltage. Second I wonder why it works only while debugging. Thanks for any help. Dan |
|
相关推荐
9个回答
|
|
CN12是RB14,不是RB15。抱歉,错误的数据表。
以上来自于百度翻译 以下为原文 Sorry, wrong datasheet. |
|
|
|
我也怀疑混合CN和RB的混合,但是在HTTP://WW1.MICCHIP.COM/DeLoSts/En/DeVICEDC/70593D.PDFI中,只有Pi-36(DS70593D页面15=DSSPIC3FJ128GP708A)AN15/OCFB/CN12/RB15找到了这个标签。
以上来自于百度翻译 以下为原文 I also have suspected a mix-up of the combination CN and RB, but in http://ww1.microchip.com/downloads/en/DeviceDoc/70593d.pdf I only found this label for the pin-36 (DS70593D-page 15 = dsPIC33FJ128GP708A) AN15/OCFB/CN12/RB15 |
|
|
|
您好,您使用的是哪种编程/调试工具?AN15/OCFB/CN12/RB15也是一种具有模拟特性的PIN。一些调试工具将模拟引脚设置为数字状态,而不进行调试,但仅在调试时确保程序中有代码以启用数字输入放大器,该设备具有2个AD转换器,AD1PCFGL和AD2PCFGL。上拉是一种调节电流源,它是一个具有电压差的半导体结构,当没有负载时,它不是一个没有电压差的电阻器。RE是无负载,但不保证它作为逻辑高输出工作。然而,我使用内部250 UA上拉用于I2C上拉短路和100千赫信令用于测试。
以上来自于百度翻译 以下为原文 Hi, What kind of programming/debugging tool are you using? AN15/OCFB/CN12/RB15 is also a pin with Analog properties. Some of the debugging tools set analog pins to digital state without telling, but only when debugging. Make sure there is code in the program to Enable the Digital Input Amplifier, On this device with 2 AD converters, both AD1PCFGL and AD2PCFGL must be set correctly. The pull-up is a kind of regulating current source, it is a semiconductor structure with a voltage difference, it is not a resistor with no voltage difference when there is no load. PIC datasheets generally promise that the pull-up will be detected as high level input, when there is no load, but do not promise that it work as logic high output. I have however used internal 250 uA pull-up for I2C pull-up with short wiring and 100 khz signaling for testing. Regards, Mysil |
|
|
|
您好,请参阅数据表注释1至第249页。您需要将BothAd1PCFGL和AD2PCFGL配置为数字,AN0 AN15在2个ADCSONE上复用。
以上来自于百度翻译 以下为原文 Hi, Please read page 249 of the datasheet notes 1 to 4. you need to configure BOTH AD1PCFGL and AD2PCFGL to digital as AN0-AN15 are multiplexed on the 2 ADCs Regards |
|
|
|
MysIL很可能是调试器关闭调试器“模拟选项禁用”的正确方法。尝试清除ANSELB.15以禁用模拟输入功能。
以上来自于百度翻译 以下为原文 Mysil is most likely right about the debugger switching off the 'analog option disable' by the debugger. Try to clear ANSELB.15 to disable the analog input function. |
|
|
|
在这个DSPIC中没有ASELB,它是AD1PCFGL和AD2PCFGL。我查错了数据表,没有提到AD2PCFGL。
以上来自于百度翻译 以下为原文 There is no ANSELB, it's AD1PCFGL and AD2PCFGL in this dsPIC. I looked in the wrong datasheet, which didn't mention AD2PCFGL. |
|
|
|
嗨,这2个指令应该为ADC做工作:AD1PCFGLITS.PCFG15=1;AD2PCFGLITP.PCFG15=1;问候。
以上来自于百度翻译 以下为原文 Hi, These 2 instructions should do the job for the ADC : AD1PCFGLbits.PCFG15 = 1; AD2PCFGLbits.PCFG15 = 1; Regards |
|
|
|
谢谢大家!事实上,我错过了AD2PCFGL寄存器。这是我第一次使用两个寄存器设置模拟/数字配置的PIC。补充说,现在效果不错!丹
以上来自于百度翻译 以下为原文 Thanks to all of you! Indeed I missed the AD2PCFGL register. It's the first time I use a PIC with two registers to be set for the analog/digital configuration. That added, it works fine now! Dan |
|
|
|
嗨,这个DSPIC族有AN0到AN15,它们都进入ADC1和ADC2。所以你需要初始化2个寄存器。
以上来自于百度翻译 以下为原文 Hi, This dsPIC family has AN0 to AN15 which enter both into ADC1 and ADC2. So you need to initialize 2 registers Regards |
|
|
|
只有小组成员才能发言,加入小组>>
5184 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3179 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2230 浏览 5 评论
742浏览 1评论
628浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
512浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
640浏览 0评论
538浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 19:53 , Processed in 1.455224 second(s), Total 93, Slave 76 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号