I am using the attiny15l, which has no ram :( The test I did today resulted as follows:
The only reset occuring is the watchdog.
If i place a statments like:
***********************************************
in cpu_reset,mcusr ; retrieve reset flags
clr temp
out mcusr,temp ;clear reset flags
sbrc cpu_reset,3 ; run init if not wdt reset
rjmp main
init:
ldi temp,$0f ; setup watchdog
out wdctr,temp
main:
*********************************************
The watchdog does not run the second time. I read that the watchdog can only be shut off by a series of statements.
What could be killing the mcu? Shouldn't the watchdog survive its own reset?
Jamie
David VanHorn <dvanhorn@cedar.net> wrote:
At 05:48 AM 4/27/2004 -0700, jamie pollock wrote:
>I am in assembly only, This is why i can't understand what to do to preserve the registers. I have tried storing the data in 0cr1a and r30,r29 ect. but it still wipes it out.I still need to check the mcusr to see if the watchdog is the only reset which is occuring.
>If i use eeprom, it will wear it out. I want to have a index of cycles the micro is going through.
Store the data in SRAM.
SRAM isn't wiped out on reset, until your code wipes it.
Wearout in EEprom is an issue, but there are ways around that.
Initialize an area of EE to 0xFF, with the first pair of bytes, to 0x00.
When you want to store your counter data:
Write your counter to the first pair of bytes which is not 0xFF
Read it back.
If it's not the same, then use the next pair of bytes in EEprom
When you want to read out the data, take the last pair of bytes that is NOT 0xFF.
>Larry Barello <yahoo@barello.net> wrote:
>Yep. This is the most effective way to do a hard reset... The registers and SRAM shouldn't be affected, but if you are using C the startup runtime will clear everything out for you. The hardware registers (e.g. I/O & peripherals) will be wiped out.
>
>You might get away with a bit of assembly code, intercept the reset vector (can't help you with how...) check to see the reset source and skip the C-runtime init code if it were watchdog. However, there would be a host of issues to resolve: which C variables need initializing, and which you want to save, etc. Not a trivial problem.
>
>
>-----Original Message-----
>From: jamie pollock
>I am using the watchdog to come out of sleep mode. The watchdog seems to work fine ( i can turn it off sucessfully and re-enable it). My trouble is that when the watchdog resets it doesnot resume after the sleep. The controller begins at the reset vector and clears my registers. Is this what it is supposed to do? I think the documentation states that the registers would be intact.
>
>
>Do you Yahoo!?
><http://pa.yahoo.com/*http://us.rd.yahoo.com/hotjobs/hotjobs_mail_signature_footer_textlink/evt=23983/*http://hotjobs.sweepstakes.yahoo.com/careermakeover>Win a $20,000 Career Makeover at Yahoo! HotJobs
>
>----------
>Yahoo! Groups Links
> * To visit your group on the web, go to:
> * <http://groups.yahoo.com/group/AVR-Chat/>http://groups.yahoo.com/group/AVR-Chat/
> *
> * To unsubscribe from this group, send an email to:
> * <mailto:AVR-Chat-unsubscribe@yahoogroups.com?subject=Unsubscribe>AVR-Chat-unsubscribe@yahoogroups.com
> *
> * Your use of Yahoo! Groups is subject to the <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AVR-Chat/
To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs