Hello Reader,
I am currently working on a project where we are managing a lot of timing events in the forground. We have a verison of the firmware that runs on a PC to simulate it and it's reliant on getting a timestamp. I'm porting this over to our MSP. I'd like to be able to just setup a timer to count up continously and then just read TAxR in the forground but there is this note in the family guide that makes me hesitant.
Here is a quote from the Family Guide Slau445i (https://www.ti.com/lit/ug/slau445i/slau445i.pdf):
"13.2.1 16-Bit Timer Counter The 16-bit timer/counter register, TAxR, increments or decrements (depending on mode of operation) with each rising edge of the clock signal. TAxR can be read or written with software. Additionally, the timer can generate an interrupt when it overflows.
NOTE: Accessing TAxR Care must be taken when accessing TAxR. If TAxR is accessed (read or write) by the CPU while the timer is running, the value read from TAxR or the value written to TAxR could be unpredictable. To avoid this uncertainty, the timer should be stopped by writing the MC bits to zero before accessing TAxR. For read, alternatively TAxR can be read multiple times while the timer is running, and a majority vote taken in software to determine the correct reading."
I don't want to stop the timer when I read from it so I suppose that leaves me with reading the timer multiple times and taking a majority vote. But what does that mean? Do I read multiple times and save the values into an array and then choose the most frequent value out of the array? Alternatively, could I just use a capture register some how and then read from that?
Thank you for your time and any feedback you may have.
Regards,
Zachary Anderson