dear all,
(1)if using a 4mhz quartz, and using no prescalar or post scalar, and if i want to interrupt every 5ms, that wld requird 5ms/1us = 5000 instructions.. 5000 = 0x1388 and pr2 register only 8 bits so unable to hold such a big value...
(2)So with the same configurations but with a prescale of 1:16, this will give me (1/(4*prescaler)) * CLK freq = (1/(4*16)) * 4Mhz = 62500Hz or 16us per machine instruction...To interrupt every 5ms, i will need 5ms/16us = 312.5 , again too big for the pr2 register which is 8 bits..
(3)So my question is how do i use postscaler? if i am using both post and pre scal, will i be able to make the value smaller so that i can write to pr2?what is the general way to calculate the value i need to write to pr2 reg if i am using both prescalar and post scalar. Is there a maths like formula as i wrote in part (2) that explains how to get the value if i am using pre and post scaler??
I hope those who have an idea of what i am saying can sound me out..thanks
(1)if using a 4mhz quartz, and using no prescalar or post scalar, and if i want to interrupt every 5ms, that wld requird 5ms/1us = 5000 instructions.. 5000 = 0x1388 and pr2 register only 8 bits so unable to hold such a big value...
(2)So with the same configurations but with a prescale of 1:16, this will give me (1/(4*prescaler)) * CLK freq = (1/(4*16)) * 4Mhz = 62500Hz or 16us per machine instruction...To interrupt every 5ms, i will need 5ms/16us = 312.5 , again too big for the pr2 register which is 8 bits..
(3)So my question is how do i use postscaler? if i am using both post and pre scal, will i be able to make the value smaller so that i can write to pr2?what is the general way to calculate the value i need to write to pr2 reg if i am using both prescalar and post scalar. Is there a maths like formula as i wrote in part (2) that explains how to get the value if i am using pre and post scaler??
I hope those who have an idea of what i am saying can sound me out..thanks