Re: >If I have managed to get this correct so far (my first timer playing with >interrupts on any micro!) could some one please tell me how I set a >prescaler value of 4? I know I have to set the PS0:PS2 bits, but have no how >these bits create a prescaler value. I have read the datasheet pretty >thourghly, but still don't understand. One way you can set the prescalar in HI-TECH PIC C is this: PSO = 1; PS1 = 0; PS2 = 0; Then, your interrupt routine should look like this: void interrupt MyInterrupt( void ) { if ( TOIE && TOIF ) { T0IF = 0; TMR0 -= 250; // do your 1ms stuff here } } This way the prescalar is set to 1:4, meaning that TMR0 increments every 4 instruction cycles. You've done the other setup correctly, i.e. T0CS = 0; PSA = 0; T0IE = 1;. The "-=" reset of TMR0 in the interrupt handler adjusts (to a certain degree) for the fact that between the time that the interrupt happens (i.e. TMR0 rolls over from 0xFF to 0x00) and when you actually end up inside MyInterrupt(), some time has expired, and TMR0 has advanced. It will probably be at, say, 0x06 or so (24 instructions). If you're already at 0x06, you want the _next_ interrupt to happen only 244 "ticks" from now (not 250!). By using "-=" it auto-adjusts for you. There is some error, since you're using a non 1:1 prescalar, but for your application it probably is irrelevant. Hope this helps ... -- ______________________________________ Andrew E. Kalman, Ph.D. aek@pumpkininc.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body