Atmega161 timer 0 simulation error

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm having trouble simulating code that uses timer 0. I use timer 0 to generate a 2ms period "tick" interrupt using the overflow interrupt and have used this technique with other AVR family members with absolute reliability.

1. The overflow interrupt does not seem to be generated in the simulator. thi sis with code that has been absolutely reliable on other processors and simulates correctly on studio 3.54

2. When I use output compare instead of overflow to generate an interrupt, it works only when the T0 output compare register is non zero. Does the simulator have code that tests if (overflow) else if (output compare) or something like that instead of testing both conditions in parallel?

3. When I do get the output compare interrupt, the period between interrupts (using the stopwatch) is sometimes 1.024ms and sometimes 2.048 ms. This appears to be random. The prescalar & count registers are not being changed by anything else and (again) the same code has been absolutely reliable for several projects.

admin's test signature