I am trying to trigger an alarm after 24 hours using timer5 of dspic30f4011 using 1:256 as prescale.
using maximum value of timer (0xFFFF) i tried iterating for counter of 125 and 250, for this values it works but if i enter any value after 250 my timer seems to be stuck and it doesnot trigger alarm.
As mentioned in my top comments, we want an MRE.
But, 24 hours is a long time for an interval timer. So, I don't think this can be done purely with the timer hardware as the timer compare registers are [AFAICT] limited to 16 bits. Even at one interrupt / second, this is 86400 (0x15180) interrupts which is beyond 16 bits
We'll have to do this in S/W [with a "tick" counter]. This is how most systems do it.
Here is an example. It assumes that the timer ISR is called once per millisecond [adjust to suit]: