CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Minimizing accidental MCLR resets

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kgng97ccs



Joined: 02 Apr 2022
Posts: 97

View user's profile Send private message

Minimizing accidental MCLR resets
PostPosted: Sat Feb 04, 2023 12:29 am     Reply with quote

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: 19513

View user's profile Send private message

PostPosted: Sat Feb 04, 2023 5:59 am     Reply with quote

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: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Feb 04, 2023 7:10 am     Reply with quote

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' .
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group