Using PIC MCLR as digital input

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,619
I want to useClipboard_09-09-2025_01.jpg the MCLR pin of a PIC12F1822 as a digital input but protect from the programming voltage.
I came up with the circuit below. Will this work and not blow up the DS3231?
 

John P

Joined Oct 14, 2008
2,051
The circuit looks good to me just the way it's shown. If 12V or whatever it is gets applied to pin 1 of JP1, then the diode should prevent any current flow toward the DS3231, and it'll be safe.

Edit to say, is it possible that the Vpp pin will carry 0V rather than 12V at some point, while the DS3231 is still generating a square wave? That would leave the SQW pin shorted to ground via the diode when it's in the high state. Maybe that's harmless, but I'd check the data sheet.
 

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,619
I haven't been able to find out what a PICKIT does with MCLR during debugging so that will have be prototyped. The SQW pin is open drain so shorting to 0V will not harm it
 

trebla

Joined Jun 29, 2019
599
I haven't been able to find out what a PICKIT does with MCLR during debugging so that will have be prototyped
You must use the debug header chip for debugging the PIC12F1822 on HW. According to Memory Programming Specification for PIC12F1822 in section 4.1 the MCLR/Vpp is used for entering into programming/verify mode via raising voltage on this pin to +8..9V, so the DS3231 will be in safe side in your circuit.
 

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,619
According to Mchip this chip has integrated debugging.

PIC12F1822-I/P
Country of Origin (COO): Thailand

FACTORY PROGRAMMABLE IN PRODUCTION




Debug Support
• Integrated debug support on Device. No debug header is required
• Optional external debug headers, AC244043 (F) / AC244044 (LF), are also available
• Debug and programming support is available via PICkit™ 3, and MPLAB® ICD 3
• For Debug Header information, please refer to DS51292
 
Top