MKII debug wire ATmega88 and timer0 overflow interrupt

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use avrstudio 4.12. I see TCNT0 increase, I see TOV0 set (in TIFR0 register), TOIE0 is set (TIMSK0) but the TIM0_OVF never start. This routines was copied from a code generated for an ATmega8515 and works great. Where have I to research for my trouble?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What language was your ATmega8515 program written in? Did you remember to change the target processor from ATmega8515 to ATmega88?

If it is an assembly program, then look at the data sheets for these two different processors. Specifically the register summary. The ATmega8515 register addresses all fit into a $3F address space where IN and OUT instructions work. The ATmega88 register addresses exceed $3F and must use LDS and STS instructions beyond $3F.

No matter what language you use, the registers that control timer/counter0 are completely different. Look at the timer/counter0 register descriptions in the different data sheets and you will find the bit arrangements are completely different and the register names are different (this is mainly because the 88 has an extra output compare channel the 8515 does not have). The 8515 timer/counter0 only has 4 modes of operation while the 88 has 8 modes of operation. You need to use the data sheet and figure out how the 8515 was using timer/counter0, then rewrite this for the 88 timer/counter0.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry but today I discover the trouble. I don't know why but automated code generator for initialization devices doesn't inserted

#asm
sei
#endasm

I declare to use TIM0_OVF interrupt and code generator write the ruotines, but doesn't tell the micro to enable global interrupt !!!!
Thanks Micke B for your reply :D