Thanks very much. I had noticed that it seemed to be divied by 4 but wasn't sure thanks for the clarification. Wesley On Thu, 29 Jul 1999, Jim Robertson wrote: > At 11:33 29/07/99 +1000, you wrote: > >I am attempting to use this delay code from: > >http://www.dontronics.com/rtc.html#pic2 > > > >From what I can work out the equation gives the number of instructions > >which are executed. I am using a PIC16F84 (10Mhz) and want to know who to > >convert instructions to time. I have gone through th F84 data sheet and it > >doesn't specificly say how many clock cycles are used per instruction. It > >says 'cycles' but this is 1 or 2 and 0.1uS sounds a bit small. > > The internal cycles are the clock speed divided by 4. So at 4Mhz the > instruction > time is 1uS or 2uS. At 10Mhz it is 0.4uS or 0.8uS. > > Instructions that modify the program counter take two internal cycles and > these > are CALL, GOTO, RETLW, RETURN or anything that uses the PC as a destination > such > as a ADDWF PC. > > Jim > > > > >Thanks for your help in advance. > > > >Wesley > > > >The routine is below, it may have been mucked up by the mail program > >(wrapping). The link above will take you to the original version. > > > >delay movlw 0x001 ;standard delay routine. increase > >w value > > movwf count1 ; for increased delay > > movlw 0x001 ;can set up any delay by calling > >delay1 (NB!) > > movwf count2 ; with pre-set values in count1, > >2, 3 > > movlw 0x020 ;ex Myke Predko, piclist 4 Jan97 > > movwf count3 ;delay, (no of instructions)= > >delay1 decfsz count3,same ;2 + 5*(count3-1) + > > goto $-1 ;2 + (5*255 +2+5) * (count2-1) + > > decfsz count2,same ;2 + (5*255*256 +2 + 5*255 +2+5) > >*(count1-1) > > goto $-3 ; = > > decfsz count1,same > >;5(count3-1)+1282(count2-1)+327684(count1-1)+6 &nbp; > > goto $-5 ; return ; > > > Regards, > > Jim Robertson > NEWFOUND ELECTRONICS > ________________________________________ > Email: newfound@pipeline.com.au > http://www.new-elect.com > MPLAB compatible PIC programmers. > ________________________________________ >