Search found 1 match
- Sat Jan 20, 2024 3:35 pm
- Forum: General discussion
- Topic: Using interrupts to extend a 32-bit timer to 64 bits and a pitfall to avoid
- Replies: 2
- Views: 2145
Re: Using interrupts to extend a 32-bit timer to 64 bits and a pitfall to avoid
Two points about this solution: First you do not need a 64 bit overflow counter - the upper 32 bits are unused. The fcount64 expression certainly needs to be 64 bit, but that can be done with a cast: fcount64 = ((uint64_t)tim2overflowcounter << 32) + lsfcount; Second the read of the upper and lower ...