Bryce Reeve wrote: >I have started programming a 20 MHz 16f877 chip (using Hi-Tech C). I >wish to have an interrupt formed every 1ms. So I have Timer 1 >generating an interrupt. However the by preloading the timer I can >get an interrupt happening every 985s, if I the loading value. The >next step I get is a period of 1037us. Surely I should be able to get >closer to 1ms than this? > .......... > TMR1IE = 1; // interrupt on overflow > TMR1IF = 0; // clear flag to start with .......... >Any suggestions on where I might be able to improve the code to get a >1ms interrupt happening that I can rely on? I am relatively new to C >and brand new to PICs so all comments are apprieciated. > With Timer1, try using the "special event trigger" interrupt mode - selected by CCP1CON = xxxx1011. This way you initialize Timer1 once, and the value acts as the interrupt "period". I assume '87x work the same as older '7x chips. best regards, - Dan Michaels Oricom Technologies http://www.sni.net/~oricom ========================== -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu