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

MCLR OPERATION

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







MCLR OPERATION
PostPosted: Wed Aug 10, 2005 12:54 am     Reply with quote

Dear Sir,

I wish to know whether general purpose registers in data memory are cleared ( READ AS '0') by an MCLR reset?.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Aug 10, 2005 1:31 am     Reply with quote

No they are not.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
MikeValencia



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Wed Aug 10, 2005 7:57 am     Reply with quote

An MCLR reset will eventually bring you back to the first of line of main(). You should take care to initialize RAM values and make no assumptions about general purpose registers. In fact many GPRs are allso initialized with 'x' on the datasheet, meaning 'unknown'. So make no assumptions.

I've noticed some of CCS's library functions take care of initializing values for you. For example, when you want to read eeprom, the compiler sets certain bits to make sure you're reading eeprom, and not Flash. An assembly language guy would easily overlook thiis, and ignore the reset values of this GPR. An example consequence in the past was that there was a 20% field return rate of the shipped product (which was written in assembly). I helped my dad debug this, and to tell you the truth, I used CCS to get an example compilation and disassembly of the eeprom_read() function. It was a one-line fix to remedy this 20% field return problem! After that, no more shipped product had that problem; at that point, other problems showed up and caused a lesser field return rate.

So my point is, it is good practice NOT to make assumptions on reset values, regardless if it was due to an MCLR reset or a POR.
vin
Guest







reset conditions
PostPosted: Wed Aug 10, 2005 9:43 pm     Reply with quote

Dear,

Thank you for valueble informations. since i am new to this field i want clarifications in some more points. what is the difference between an mclr reset and poweronreset. Actually when a vdd rise is detected an internal power on reset is happenned then why we tied vdd to mclr using a resister(as mentioned in datasheet) . i kindly request you to give the solution.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Aug 10, 2005 9:49 pm     Reply with quote

You may want to be able to reset the PIC as a result of an external event or device. Maybe you want to allow a user to reset the PIC. You do this via the MCLR line. You already have the pullup resistr (as you mentioned) so the minimum we need to add to suport a user reset via MCLR is a switch between the MCLR pin and vss.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Aug 11, 2005 10:46 am     Reply with quote

or put an output pin the mclr. Then software can reset itself,... and you KNOW how startup will start.

No misterious registers left in wierd states,.. ect.
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