Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Issues with watchdog and pic18f452

Status
Not open for further replies.

Tulkas

Member level 4
Joined
May 30, 2002
Messages
70
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
646
I have made a datalogger with pic and MMC/SD card, sometimes the card doesn't respond correctly and the system stops. The card is changed every 4 month and during this time i don't know nothing about datalogger, if the system stop measure i can loss lot of data. Because of this i have programed WDT, but i have some register with information that i need for the system continue adquiring data after a WDT reset, but this registers seems to be change. WDT clears all ram registers??.

Thanks

Sorry for my English.
 

Re: watchdog and pic

Indeed it does, i remember one time i forgot to disable the WDT and all my ports and registers changed their values, is a resent, you get random values anfter WDT resets the micorcontroller.

Save those registers in external memory if you want to keep that data.
 

Re: watchdog and pic

First of all you should tell us which PIC you are using if your software is written in assembler or C (which compiler) :)

Next you can look at the datasheet of your PIC and you will see that some registers are changed at a reset but normally not the ram ....

BUT if your software is programmed in C all static variables will be cleared by the powerup routine (compiler specific) some compilers have special keywords for variables that should not be changed by the powerup routine also some compilers have a customable powerup routine.

So you see there are a lot of possibilities ...

hope this helps and best regards
 

Re: watchdog and pic

I'm using pic18f452 and assembler language with mplab. In the datasheet i haven't found if the ram registers change after reset (I have not seen it clearly). Datasheet says free ram doesn't change after WDT reset??. I can't save data in a external ram because i need high speed and if i have to store those registers in a memory i can loss data.

Thanks.
 

Re: watchdog and pic

For data logging purposes you really should cosider nonvolatile RAMS. They retain data regardless of power loses. Example: DS1230 ( https://www.chipcatalog.com/Maxim/DS1230AB.htm )
And speed is not real issue here if you take into account that access time is something like 80ns.
In your application, what speed do you have in mind? µs, ms ???
Maybe even I2C EEProms would be good option..
Regards,
IanP
 

Re: watchdog and pic

Using the 18F452 you should check RCON register on a reset you can see if the reset was caused by the watchdog.

In this case your software should not initialize the ram registers you need for your system so the information is retained.

You will have bad luck if the reset was caused by the brownout detector because chances are very high that your memory might be currupted in this case ...

best regards
 

Re: watchdog and pic

generally on reset or brownout all the ram register contents are suscetable to change or loose its content accuracy(bits may change). some times it may happen or some times it may not happen. we can't take for gaurantee.
 

Re: watchdog and pic

The watchdog timer does not affect the RAM. I suspect something else is wrong.
Do you know for sure it is the WDT that resets the micro? Did you check RCON to know for sure?

The RAM data retention voltage is actually 1.5V for this device, so unless the supply voltage drops below this value, the RAM contents should be preserved. Reset will not affect the RAM contents.

So, try to identify what the problem is. If it is really the WDT, then estimate more accurately the time between two clrwdt instructions and see if you are marginal on that. The WDT has a large variation on the timeout period. Plus, it varies with temperature (and they do not test it at the factory to guarantee it).
So if you are close to the minimum, try clearing the WDT more frequently.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top