


So what needs to be done, is to arrange for the AC waveform to alternately set and clear the OUT bit.then you can get zero cross detection. When the micro's current sink is operating, the OUT bit of the ZXDxCON register is set, and when the current sourse is operating, the OUT bit of the ZXDxCON register bit is cleared. As such, it is current detection which is done to detect Zero cross. Thanks, the datasheet is saying that the microcontroller actually detects current flow from its internal current sink and current source. But with the AC Mains setup of the attached schematic and simulation, this situation is not prevalent…and therefore the resistor to ground is needed (ie from ZCDxIN pin to ground)…do you agree? The schematic (page 315) in the PIC16F18856 datasheet shows a situation where the AC source and the microcontroller are both referenced to the same “ground”. If one never operates then there will be no zero cross detection.Īs such, the resistor to ground (R5 in the attached schematic, is necessary for zero cross detection). Section 21.2 of page 316 of the PIC16F18856 datasheet makes it clear that the zero cross detection needs both the internal current source, and also the internal current sink, inside the micro, to operate alternately. If the resistor to ground is absent, then the current source internal to the PIC16F18856 will not operate, and therefore zero cross will not be detected…. Please can you confirm that the Zero Cross Detector inside the PIC16F18856 can only work with a mains input (as in the attached schematic and LTspice simulation) if there is also a resistor to ground from the ZCDxIN pin? (R5 in the attached schematic).
