The code could also be changed thus, not that it makes a difference:
Code:T1PS = 1 ; start with 1:1 postscaler TimerConst = ((OSC*1000000)/4/100)+8 ; how many timer ticks will it take while TimerConst > 65400 ; if it's more than the timer can count T1PS = T1PS * 2 ; double the postscaler TimerConst = TimerConst / 2 ; halve the count endw TimerConst = 65536 - TimerConst ; final reload value
Bookmarks