How can I integrate it in my code ? Please have a look on ;....... 1ms timer counter here..... The code : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D /* *//*COUNT RES 1 ;COUNT OF INTERRUPTS*//* *//*COUNT1 RES 1 ;COUNT FOR 1 SECOND TIMER*//* *//* *//* *//* *//*;----------------------------------------------------------------------= --------*//* *//*PROG0 CODE ; program code section*//* *//*;----------------------------------------------------------------------= --------*//* *//*TimerInt ; Interrupt routine*//* *//* *//* global TimerInt ; Define as global *//* *//* *//*intsOff bcf INTCON, T0IE ;Disable timer interrupts*//* *//**//* *//*;-------------- Insert no new code above here=20 ---------------------------------*//* *//* LedTimer EQU 0x0A *//* *//* *//**//* *//*;**********************************************************************= //* *//* ; 1 ms timer function calls*//* *//*;**********************************************************************= //* *//* bcf STATUS, RP0 ;Select Bank 0*//* *//* bcf STATUS, RP1 *//* *//* *//* ;....... 1ms timer counter here..... *//* *//**//* *//* clrf TMR0 ;Clear TMR0 and prescaler*//* *//* banksel TMR0*//* *//* movlw 0xB2 ;Count=3DB2 *//* *//* movwf TMR0*//* *//**//* *//* timer1ms*//* *//* movf LedTimer,f*//* *//* btfsc STATUS,Z*//* *//* decf LedTimer,Z*//* *//* return*//* *//**//* *//* ;....................................*//* *//* *//* incf COUNT, f*//* *//* movlw .10 ;Compare count to 10 decimal*//* *//* subwf COUNT, W ;Store the result back in *//* *//* btfss STATUS, C ;Is the result 0, skip if no*//* *//* goto exittimer*//* *//* *//* clrf COUNT ;Clear count register*//* *//**//* *//*;**********************************************************************= *//* *//* ; 10ms timer function calls*//* *//*;**********************************************************************= *//* *//* ;....... 10ms timer counter here..... *//* *//* timer10ms*//* *//* movf 0x0A*//* *//* btfsc STATUS,Z*//* *//* goto timer10ms*//* *//**//* *//**//* *//* ;....................................*//* *//* *//* incf COUNT1, f*//* *//* movlw .10 ;Compare count to 100 decimal*//* *//* subwf COUNT1, W ;Store the result back in *//* *//* btfss STATUS, C ;Is the result 0, skip if no*//* *//* goto exittimer*//* *//* clrf COUNT1*//* *//*;**********************************************************************= *//* *//* ; 100ms timer function calls*//* *//*;**********************************************************************= *//* *//* ;....... 100ms timer counter here..... *//* *//* timer100ms*//* *//* movf 0x64*//* *//* btfsc STATUS,Z*//* *//* goto timer100ms*//* *//* ;....................................*//* *//**//* *//* *//*exittimer *//* *//* movlw .217 ;count 14*//* *//* movwf TMR0*//* *//**//* *//**//* *//* *//**//* *//*;-------------- Insert no new code below here=20 ---------------------------------*//* *//* bcf INTCON, T0IF ;Clear timer overflow flag*//* *//*; bsf INTCON, T0IE ;Enable interrupts again*//* *//* return*//* *//*;----------------------------------------------------------------------= ------------*//* *//*;**********************************************************************= *************//* *//*initTimer*//* *//* Global initTimer*//* *//* GLOBAL COUNT*//* *//* clrf COUNT*//* *//* clrf COUNT1*//* *//* call timer1ms*/ /*return*/ ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Thank you On 29/06/2013 1:45 PM, eCHIP wrote: > If you need a 100 mS delay with a 4 MHz PICmicro, below is the code. > > delay1mS movlw .250 > movwf temp1 > clrwdt > decfsz temp1,f > goto $-2 > retlw 00 > > > delay100ms movlw .100 > movwf temp > call delay1ms > decfsz temp,f > goto $-2 > retlw 00 > > Cheers > > Ravi > > >> Hi, when you post to the Piclist you need to put an appropriate topic >> tag in the subject line. This time I have added one to your message. Bob >> >> On Fri, Jun 28, 2013, at 10:04 PM, Electronic Consultation wrote: >>> Guys, >>> >>> Am I creating a right counter for PIC ? >>> >>> timer100ms >>> movlw 0x64 >>> movwf COUNT1 >>> decfsz COUNT1 >>> return >>> >>> thanks --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .