View previous topic :: View next topic |
Author |
Message |
vin Guest
|
MCLR OPERATION |
Posted: Wed Aug 10, 2005 12:54 am |
|
|
Dear Sir,
I wish to know whether general purpose registers in data memory are cleared ( READ AS '0') by an MCLR reset?. |
|
![](templates/subSilver/images/spacer.gif) |
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
![](templates/subSilver/images/spacer.gif) |
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Wed Aug 10, 2005 7:57 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
vin Guest
|
reset conditions |
Posted: Wed Aug 10, 2005 9:43 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Wed Aug 10, 2005 9:49 pm |
|
|
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!! |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Aug 11, 2005 10:46 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
|