How is the 16-bit Timer value setup?
Answer The 16-bit Timer/Event counter is a count up counter, which will count up to a value of 65535, which is 0FFFFH, after which it will overflow and generate an interrupt. If it is required to count up to a value N, where N<65536, then the value which must be placed into the timer’s registers is equal to 65536-N. After setting up the timer registers and starting the timer, the timer will count to a value of 65535, after which it will overflow on the next count, which is 65536. Therefore the counted value will be 65536-(65536-N) = N.