View previous topic :: View next topic |
Author |
Message |
deepakomanna
Joined: 06 Mar 2007 Posts: 92 Location: Pune,India
|
Brown out detect query |
Posted: Mon Jul 21, 2008 8:10 am |
|
|
Dear sir,
I am using CCS PCM C Compiler, Version 4.073, 42663 & Pic 12f629 device.
I want to know is, if i enabled Brown Out Detect, then whenever brown out detect occurs this will clear the device RAM ? Also in my soft code if i add RESET_CPU(); that time start up code also executed ? _________________ Thank You,
With Best Regards,
Deepak. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jul 21, 2008 12:15 pm |
|
|
Quote: | will this clear the device RAM ? |
Download the 16F Reference manual for Reset:
http://ww1.microchip.com/downloads/en/DeviceDoc/31003a.pdf
Read section 3.1. It says what happens to non-SFR registers upon reset.
(i.e., they are not changed).
However, if you have #zero_ram in your program, or if you have static
global variables, then these ram locations will be zeroed upon reset.
Quote: | Also in my soft code if i add RESET_CPU(); that time start up code also executed ? |
Download the 12D629 data sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/41190E.pdf
Look at this section:
Quote: | TABLE 9-6: INITIALIZATION CONDITION FOR SPECIAL REGISTERS |
It shows the Program Counter = 000h after a "Brownout Detect" reset.
This is the same as for "Power-on Reset". Therefore, all code that
executes at power-up will also execute at Brownout reset.
Read the CCS manual for the Reset_CPU() function. It says:
Quote: | reset_cpu( )
This is a general purpose device reset. It will jump to location 0 on PCB and PCM parts. |
Then ask yourself why you want to put in program code to jump to 0,
after you just started at 0 because of a Brown-out reset. |
|
|
vijay s
Joined: 20 Oct 2007 Posts: 17 Location: coimbatore,india
|
|
Posted: Tue Jul 22, 2008 7:24 am |
|
|
i too have a doubt in brown-out.. actually the processor resets when the brownout occurs.if i have to store the current process state in EEPROM before processor resets(book keeping).. how to do it _________________ with regards
vijay s |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Tue Jul 22, 2008 8:27 am |
|
|
I think the common way is to use a ADC to monitor the main power feed.
Disable brown out. You want as much time to process as possible.
Then if it Vpp drops, start saving as much data as possible.
Use a large 1F cap to provide time to store data.
Then when done storing data, shutdown/reset. And then don't come back
out of reset until the main voltage is nice and stable.
http://www.maxim-ic.com/appnotes.cfm/appnote_number/3517/ln/en |
|
|
|