I’m struggling with a simple problem trying to read a 16 bit counter value. Using 2560
I have an interrupt driven timer with a view to measure the input period of an external
signal. The interrupt seems to work and yet when I read TCNT5 (saved as an unsigned int
called inputPeriod) and then attempt to print it it invariably, despite multiple strategies
to achieve it, the upper byte of TCNT5 is missing.
The frequency of the input signal should result in 16 bit values with non-zero upper bytes.
Code.txt (458 Bytes)