In order to have a precise delay with this kind of routine: tmr0_task_8 ;timer 0 = 0,5ms ..... incf Cnt,F ;aux. reg. movfw r1 ;1st stage of compare xorwf Cnt,w ; 0,5 x r1 btfss STATUS,Z ; goto _tmr0_task_8 ; clrf Cnt ;1st stage completed ; incf Comp,F ;aux. reg. movfw r2 ;2nd stage of compare xorwf Comp,w ;0,5 x r1 x r2 btfss STATUS,Z ; goto _tmr0_task_8 ; clrf Comp ;2nd stage completed ...... _tmr0_task_8 I have to find two registers value, r1 and r2, in a way that multiplied by a constant match a value given by the program: For example, I have a variable d'4140' and the constant 0.5. need to find r1 and r2..., r1 and r2 must be integers from 0 to 255. r1 x r2 x 0.5 = d'4140' magic routine ===> r1=120 r2=69 120 x 69 x 0,5 = 4140 I have no approaches by now but divide, desperately, randomly, crazily 4140 by 255 to 0 hoping to find an integer residual between 255 and 0 :) 4140/(0,5*r1)=r2 r1=255?, no r1=254?, no..... :p I'm studying Andy Warren delay methods to find an algorithm. Regards, Dennis. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu