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

#FUSE NOMCLR question

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



Joined: 12 Jun 2007
Posts: 68
Location: Poland, podlaskie district

View user's profile Send private message

#FUSE NOMCLR question
PostPosted: Fri Oct 12, 2018 1:01 pm     Reply with quote

I have question about MCLR pin.

As I understand this pin is to make PIC work more stable during "power on" but what is happening when I use #FUSE NOMCLR.

If I use MCLR pin during power on, when MCLR pin voltage is high enough starts program and before program starting PIC clears all registers including Program Logic Counter.

But when #FUSE NOMCLR is in code how to ensure that PIC clears all registers? I have #FUSE NOMCLR in my code because I am prototyping circuit on Mini Prototype Printed Circuit Board Breadboard and I suspect that without MCLR pin connected to voltage PIC starts its work in the place that it stopped before power off.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 12, 2018 6:12 pm     Reply with quote

MCLR is still connected to Vdd internally:
Quote:

Device Configuration Bits - PICmicro Mid-Range MCU Family

MCLRE: MCLR Pin Function Select bit
1 = Pin’s function is MCLR
0 = Pin’s function is as a digital I/O. MCLR is internally tied to VDD.

http://ww1.microchip.com/downloads/en/DeviceDoc/31027a.pdf
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Fri Oct 12, 2018 10:52 pm     Reply with quote

and the chip RAM cannot hold anything without power.
The data sheet shows the power on state for all the SFR's. The RAM is indeterminate.
Without an external MCLR connection, the chip will generally wake _earlier_ as the power rises. This can result in unexpected results if (for instance) the supply rises slowly, or the code starts to do things before the supply is genuinely stable. This is down to the code making sure it allows time for this to happen....
silelis



Joined: 12 Jun 2007
Posts: 68
Location: Poland, podlaskie district

View user's profile Send private message

PostPosted: Fri Oct 12, 2018 11:07 pm     Reply with quote

I agree that RAM and registers can not hold data without power.

Because there is no MCLR pin I added the the beginning delay_ms(1500); but next command output_high(pin_b5); (as tested) is executed after huge amount of time.

Probably I will make in prototype board MCLR circuit but wonder what with small 8 pins PICs. In some cases there is no possibility to put there MCPL so as You say the only solution is delay at the beginning. But from Your experience how long?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 12, 2018 11:33 pm     Reply with quote

Post your PIC and a description of your power supply circuit.
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Sat Oct 13, 2018 1:33 am     Reply with quote

Big question is how fast your power supply rail rises?.

There is a specification for the slowest rate this can rise, for the internal reset circuitry to work properly in the data sheet (for most PIC's). If this is not met, and there is not an external MCLR signal, then the registers may not properly reset.
Any normal supply will have no problems.

However if you have something huge like a 4700uF reservoir capacitor and a supply limited to only delivering a few tens of mA, then problems.

For example PIC18F4520. Data sheet. Electrical characteristics
D004
VDD Rise Rate
to ensure internal
Power-on Reset signal
0.05 V/ms.

So a 5v rail would have to get up to 5v, in less than 100mSec.
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