Posted: Tue Aug 16, 2005 5:34 am Post subject: Got it, thanks!`
Yep, right after I posted it, I decided to open the .dat file for the attin2313 and look through it to see why it would not run. First thing I noticed was that the .dat file has the WDTCSR listed at WDTCR. So I changed the .dat to WDTCSR=$21. I dont know if Mark may have typed in the WDTCR wrong and missed the S or if there is a reason he left it out, but I figured it should match the register name that Atmel has in their datasheet.
Next I decided to kind of let Bascom control the bit values without writing it as ASM as follows and it works fine. This little routine puts the board to sleep and then wakes it every 8 seconds and flashes an led. Very simple test program just to make sure it works properly and fortunatly it does.
Sleepmode:
cli
wdr
Mcusr.3 = 0
X = Wdtcsr
Wdtcsr = X Or &B01111001
Wdtcsr.3 = 0
sei
Powerdown
Goto Wdsub
Also, I realized that the "(1<<WDCE)| (1<<WDE)" type of equation was not readable by Bascom. I just figured bascom used the same type of ASM engine that AVR Studio used and that it could handle the same text. But anyway, I think the above code is much easier to read and understand than ASM, so I am not complaining. Thanks for the help Philm!
BTW, this watchdog interrupt mode is a godsend. This will really help to reduce the battery drain of battery powered circuits like I am designing. Instead of always on and drawing 3 ma, I can now powerdown and wake it up every so often to check what I need to check. Mark should consider coming up with some library functions to inplement this valuable feature on the AVRs since I think all of the mega and some of the tiny chips now have this watchdog interrupt. Or has this always been a feature all along in the at90S series and I just missed it?
hello Clay,
That is a very nice work,
But I subbjest to send a mail to Mark directly with a clear message:
"Bug on the Attiny2313" because yours was'nt: "Got it, thanks!"
Thanks
JP _________________ pleasure to learn, to teach, to create
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 You cannot attach files in this forum You cannot download files in this forum