Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Got it, thanks!`

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
Clay DuBois

Bascom Member



Joined: 04 Oct 2004
Posts: 14

PostPosted: Tue Aug 16, 2005 5:34 am    Post subject: Got it, thanks!` Reply with quote

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

Wdsub:
Test_led = 0
Wait 1
Test_led = 1
Goto Sleepmode


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?
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 923
Location: France

france.gif
PostPosted: Thu Aug 18, 2005 11:05 am    Post subject: Reply with quote

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
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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