View previous topic :: View next topic |
Author |
Message |
kgng97ccs
Joined: 02 Apr 2022 Posts: 97
|
Minimizing accidental MCLR resets |
Posted: Sat Feb 04, 2023 12:29 am |
|
|
I am using the PIC18LF46K22 MCU, MLAB IDE v8.92, and CCS C compiler v5.113.
Is there any way to make, through software, the MCU start an external reset only if the reset (MCLR) pin is low for a period specified in the software?
The reason I am asking is that for a battery-operated device, one may wish to set the device to sleep mode by means of a separate button before installation (to save battery power), but the reset (MCLR) pin can get accidentally pressed during handling, unintentionally causing the device to go into the normal mode of operation. I am thinking that a “delayed” reset can help to minimize accidental resets.
I will appreciate any comment or advice. Thank you. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Sat Feb 04, 2023 5:59 am |
|
|
You can't, without adding external hardware. There is a delay built in, but
it is very short. Typically 2uSec. Look at the datasheet for your chip.
/MCLR pulse width (low) in the timing section.
Consider changing the design of your reset button. Put a shroud round it,
so it needs something like a ballpen to push it. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sat Feb 04, 2023 7:10 am |
|
|
one possible option ?
disable the _MCLR pin ,changing it to an input.
then recode your program to reset based on a certain, unique, known condition.
if you have a keypad, pressing 3 buttons like 'ctrl-alt-del' could be 'reset' . |
|
|
|