Zero crossing detector module in PIC16F18856 is an Analog function, needing ANSEL?

Status
Not open for further replies.
T

treez

Guest
Hello,
We are using PIC16F18856. We are using the Zero crossing detector module which is on pin RB0. Our software engineer has set the ANSEL register to "analog" for the RB0 port, because he thinks that the ZCD function requires the corresponding ANSEL bit to be set.
However, the ANSEL register is not mentioned on page 319 of the datasheet. So do you think that the ANSEL bit should be cleared for pin RB0?

PIC16F18856 datasheet..
https://ww1.microchip.com/downloads/en/DeviceDoc/40001824B.pdf
 

If you are not using Analog function on that pin then you need to clear the ANSELB.0 bit. What compiler are you using.

If you are not using analog function in your project then code is

Code:
ANSELA = 0x00;
ANSELB = 0x00;
ANSELC = 0x00;
ANSELD = 0x00;
ANSELE = 0x00;
 

If you are not using Analog function on that pin then you need to clear the ANSELB.0 bit.
The answer isn't exactly true. ANSEL deactivates the digital input buffer to avoid quiescent current increase with input voltages between L and H level. Strictly speaking you only need to clear ANSEL bits if you are reading the digital input level from a pin. In practice you usually do it for all pure digital pins.

ZCD detector is an analog function.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…