I'd like to measure some time on the ATtiny1614 to learn more about how much time there is between certain interrupts and other events. Since there is no time measurements built-in, I'm looking for something that gives me timestamps at any time that I can subtract to get the time difference. AFAIK Arduino has millis() and micros() functions that do this. The closest match I could find is an old forum post here, but it contains code that seems to be incomplete and I can't adapt it to the current platform. I'm using AtmelStudio 7.
These are the issues I have:
- TIFR0 is undefined, probably needs to be replaced with TCA0.SINGLE.something
- TOV0 is undefined, probably needs to be replaced with TCA0.SINGLE.something
- TCA0.SINGLE.CNT is uint16_t while the old code seems to use an 8-bit timer
I think I can figure out the timer initialisation myself. I guess it should just run at full CPU clock speed and overflow at its maximum possible value (16-bit).
Could somebody please point me in the right direction to get this working?
PS: I intend to run the code at either 10 or 20 MHz from the internal clock source.