在最初的帖子中,你做了一个概括的概括,即在一个完整的设备系列中声明了错误,并坚持不懈地抵制显示了即使是一个设备的代码。我们中的一些人展示了特定设备的输出,这驳斥了你的概括。我当时认为,您的问题是由于未能理解全局上拉使能的逻辑状态和独立端口/PIN上拉状态能够以不同的方式影响上拉的原因。(0为全局启用位,1为个别启用位),而您试图读取模拟输入与启用UPS。我无法证明我的信仰,因为我们从来没有看到任何代码从你。你再也不会被打扰了。现在你又在一个设备中声明了一个bug,并假设在整个“类似”的设备中必须有未记录的bug。因为你没有显示任何代码,我们无法验证或反驳它。好吧,我质疑你对“类似”设备的一般要求。我将展示一个特定设备的例子,它显示RB0(ZCD引脚)可以用作模拟输入引脚(如果只有),ZCD模块被禁用,因为Q上边-H -B已经提到(两次)。我没有PIC16F1713来播放。我最靠近的是PIC16F1718,我认为它和你能得到的相似。(参考这些数据表),我在Vdd和VSS之间连接了一个10K的容器。我把雨刷通过1K电阻器连接到RB0,并运行了一个程序,显示了ADC读数与ZCD启用和禁用。我通过在ZCDCON寄存器中设置ZCSDN位来实现1。我通过清除ZCCDN位为零来禁用它。---注释---注释---注意,如果你有PRADMA设置ZCDDIS= OFF,ZCD将被启用,而不管ZCDCON注册器中ZCD允许位的状态。如果ZCD是启用的,RB0不能用作模拟输入引脚。这里是主程序()在我的测试程序中。输出数个值。7月14日2018在16:06:19由XC8版本1450 CPU= PIC16F1718配置设置为ZCDDIS=on(即ZCD被禁用)。10K锅通过1K电阻器连接到RB。0、将每次通过循环切换ZCD1CONBITS.ZCCDN。注意-注释-***********如果在配置设置中没有ACDDIS= on,它将忽略ZCDEN,ZCD将永远在ON上。如果ZCD是ON,则无法读取ZCD引脚上的模拟值。真的。时期。完全停止。***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************1015和lt==ZCD禁用1×238和lt;==ZCD使0 1008和lt;===ZCD禁用1 237和lt;===ZCD。通过循环的前两次是在中间的某个锅中。然后通过循环将锅设置为低值几次,接下来的两个值为高值。鲁迅:RB0为这个芯片工作,如果(如果只有)ZCD是一个模拟输入。完全停止。如果你不想创建一个简单的小程序,显示RB0不能作为模拟输入,那么,就这样吧。我不会再张贴,试图说服你。在我看来,广泛推广而不支持它对社区造成了伤害。但这只是一个观点。我的观点(就像我提到的另一个线程)是试图消除其他用户对整个家庭设备中的未被证实的bug的恐惧。所谓的bug肯定不存在于我所测试的设备。关于,戴夫(Over and Out.)
以上来自于百度翻译
以下为原文
+1 to you for that.
To the original poster:
In a previous thread you made a sweeping generalization that declared bugs in an entire family of devices and adamantely resisted showing us code for even one device. Some of us showed outputs for particular devices that refuted your sweeping generalization. I believed then that your problem was caused by failure to understand that the logic state of the global pull-up enable and the state of indiviual port/pin pull-up enables influence the pull-up in a different manner. (0 for global enable bit, 1 for individual enable bits) and you were trying to read analog inputs with pull-ups enabled. I can't prove my belief, since we never saw any code from you. You just couldn't be bothered.
Now you again declare a bug in a device and postulate that there must be undocumented bugs in an entire family of "similar" devices. Since you haven't shown any code, we can't verify it or refute it.
Well, I dispute your general claim about "similar" devices. I will show an example for a particular device that shows RB0 (the ZCD pin) can be used as an analog input pin if (and only if) the ZCD module is disabled, as q upside-down-h b has mentioned (twice).
I don't have a PIC16F1713 to play with. The closest I have is a PIC16F1718, which is, I think about as closely "similar" as you can get. (Refer to the data sheets for these.)
I connected a 10K pot between Vdd and Vss. I connected the wiper through a 1K resistor to RB0, and ran a program that showed ADC readings with the ZCD enabled and disabled. I enabled it by setting the ZCDEN bit in the ZCDCON register to 1. I disabled it by clearing the ZCDEN bit to zero.
---NOTE---NOTE---NOTE---
Note that if you have the pragma to set ZCDDIS = OFF, the ZCD will be enabled regardless of the state of ZCD enable bit in the ZCDCON regiater. If ZCD is enabled, RB0 can not be used as an analog input pin.
Here's main() in my test program.
// PIC16F1718 Configuration Bit Settings
// 'C' source line config statements
// CONFIG1
#pragma config FOSC = INTOSC // Oscillator Selection Bits (INTOSC oscillator: I/O function on CLKIN pin)
#pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled)
#pragma config PWRTE = ON // Power-up Timer Enable (PWRT enabled)
#pragma config MCLRE = ON // MCLR Pin Function Select (MCLR/VPP pin function is MCLR)
#pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled)
#pragma config BOREN = ON // Brown-out Reset Enable (Brown-out Reset enabled)
#pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin)
#pragma config IESO = ON // Internal/External Switchover Mode (Internal/External Switchover Mode is enabled)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled)
// CONFIG2
#pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off)
#pragma config PPS1WAY = OFF // Peripheral Pin Select one-way control (The PPSLOCK bit can be set and cleared repeatedly by software)
#pragma config ZCDDIS = ON // Zero-cross detect disable (Zero-cross detect circuit is disabled at POR and can be enabled with ZCDSEN bit.)
#pragma config PLLEN = OFF // Phase Lock Loop enable (4x PLL is enabled when software sets the SPLLEN bit)
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset)
#pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.)
#pragma config LPBOR = OFF // Low-Power Brown Out Reset (Low-Power BOR is disabled)
#pragma config LVP = ON // Low-Voltage Programming Enable (Low-voltage programming enabled)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include
#include "System.h"
// CHS bits for ADCON0: Register 21-1 in the data sheet
#define channel_RB0 0b01100 /* AN12/RB0 */
void main()
{
uint16_t rb0_value;
// Initialize clock, I/O, uart, adc...
init_system();
printf("nCompiled on %s at %s by XC8 version %unn",
__DATE__, __TIME__, __XC8_VERSION);
printf(" CPU = PIC16F1718n");
printf("Configuration setting is ZCDDIS = ON (i.e. ZCD is disabled).n");
printf("10K Pot is connected through a 1K resistor to RB0.n");
printf("Will toggle ZCD1CONbits.ZCDEN each time through the loop.nn");
printf("********************NOTE--NOTE--NOTE********************nn");
printf("If you do not have ACDDIS = ON in the configurationn");
printf("settings it will ignore ZCDEN, and ZCD will always be ON.n");
printf("If ZCD is ON, you can't read an analog value on the ZCD pin.n");
printf("It's that simple. Really. Period. Full stop.nn");
printf("********************************************************nn");
printf("ZCDEN RB0n");
printf("------------n");
while (1){
ZCD1CONbits.ZCD1EN = 0; // Disabled
rb0_value = get_adc_value(channel_RB0); //
printf(" %u %4u <=== ZCD disabledn", ZCD1CONbits.ZCD1EN, rb0_value);
ZCD1CONbits.ZCD1EN = 1; // Enabled
__delay_ms(100); // Give it a little time to settle down
rb0_value = get_adc_value(channel_RB0);
printf(" %u %4u <=== ZCD enabledn", ZCD1CONbits.ZCD1EN, rb0_value);
printf("n");
LED1 = ~LED1;
__delay_ms(5000);
}
}
Output for a few values.
Compiled on Jul 14 2018 at 16:06:19 by XC8 version 1450
CPU = PIC16F1718
Configuration setting is ZCDDIS = ON (i.e. ZCD is disabled).
10K Pot is connected through a 1K resistor to RB0.
Will toggle ZCD1CONbits.ZCDEN each time through the loop.
********************NOTE--NOTE--NOTE********************
If you do not have ACDDIS = ON in the configuration
settings it will ignore ZCDEN, and ZCD will always be ON.
If ZCD is ON, you can't read an analog value on the ZCD pin.
It's that simple. Really. Period. Full stop.
********************************************************
ZCDEN RB0
------------
0 543 <=== ZCD disabled
1 231 <=== ZCD enabled
0 543 <=== ZCD disabled
1 231 <=== ZCD enabled
0 36 <=== ZCD disabled
1 232 <=== ZCD enabled
0 38 <=== ZCD disabled
1 232 <=== ZCD enabled
0 1015 <=== ZCD disabled
1 238 <=== ZCD enabled
0 1008 <=== ZCD disabled
1 237 <=== ZCD enabled
The first two times through the loop are for the Pot somewhere in the middle.
Then I set the pot to a low value for a couple of times through the loop, and the next two are for a high value.
Conclusion: RB0 works for this chip as an analog input if (and only if) the ZCD is disabled.
Period. Full stop.
If you can't be bothered to create a simple small program that shows RB0 does not work as an analog input, well, so be it. I won't post again to try to convince you. In my opinion, making a broad generalization without backing it up is doing a disservice to the community. But that's only an opinion.
My point here (as it was in the other thread I referred to) is to try to dispell fear that other users might have about your alleged undocumented bug in an entire family of devices. That alleged bug certainly does not exist for the device I tested.
Regards,
Dave
(Over and out.)