Dear AVR Users,
this is my first post in this forum, so please be patient :)
I`m currently working on a quadrature encoder with a tiny3217. The decoding is done exactly the same way as the application note AN2434 describes.
And this is working just fine. But now I wanted to calculate the Rotationspeed with this formula, which I`ve got from one of my control technology books:
RPM = (((N2-N1)/N)*(fclk/(T2-T1)))*60
The problem now is that I have to get the time between the first and the last edge of the count signal (T2-T1) in a given time interval (1/fclk). The time interval is generated by the RTC, because TCA and both TCB are used for the decoding.
The count pulses have a max. frequency of 2MHz. So interrupt driven is not an option.
I thought I could use TCD and its capture function. So TCD could write its countervalue on any edge which comes from the Eventsystem into the corresponding capture register and after the time interval I can read the capture registers and get the timer value of the last edge.
But the datasheet tells me that the capture registers are not updated if the high Byte of the last value wasn`t read.
Does anybody know a workaroud for this problem or has another idea how this problem could be faced?
Thanks in advance and stay healthy!