ATTiny1614-- What happens when Timer B Overflows?

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

I'm thinking about using Timer B for frequency measurement from analog comparator output.

 

page 245 21.3.3.1.4 Input Capture Frequency Measurement Mode

 

But, timer B doesn't seem to have the ability to generate an interrupt on overflow. 

 

Should I expect it to simply wrap if the time between edges is too long to fit in the 16 bit register?  Or, maybe just stop at the MAX value?

 

Thanks!

 

 

This topic has a solution.
Last Edited: Sat. Jan 11, 2020 - 02:08 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The simulator is very useful for checking such things.
The TCA generates an event every 40000 clocks or every 80000 clocks.

At 80000 clocks, you can see that the TCB count wraps.

 

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

The datasheet is not explicit on that... I guess experimentation is needed. My bet would be, the counter wraps and keeps counting, no interrupt is generated.

 

edit: lol, while I was reading the datasheet, Kabasan was already experimentingcheeky

Last Edited: Sat. Jan 11, 2020 - 01:52 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks!

 

I have an expected frequency value , but there can be long periods of time when no events (comparator output edges) occur.  

 

If the measured count is too far from the expected, average value, I'll just ignore that sample.

 

Thanks!