I am using the following code to count pulses on TMR1, implementing = interrupts to pick up the pulses, and an interrupt on TMR0 to give a = count period. The idea is to create a tachometer which needs to be = integrated into another system. The counter works like a charm but TMR0 = doesn't seem to work. Help please. I am sure it is one of the = registers I need to be looking at but I can't figure which one. I am = using Let PIC Basic Plus. Thanks=20 Simon DEVICE 16F877 ' Set device to 16F877 DECLARE XTAL 20 ON_INTERRUPT GOTO IntCheck ' ## Configure LCD=20 DECLARE LCD_TYPE 0 ' Set LCD type =3D 0 or Alphanumeric DECLARE LCD_DTPIN PORTB.4 ' Set PORTB.4~7 as LCD DT pins DECLARE LCD_ENPIN PORTB.2 ' Set enable pin to PORTB.2 DECLARE LCD_RSPIN PORTB.3 ' Set RS pin to PORTB.3 DECLARE LCD_INTERFACE 4 ' Set 4 line interface DECLARE LCD_LINES 2 ' Set LCD to have two lines DIM myInt AS BYTE DIM myStore AS BYTE DIM myTMR AS WORD DIM TMR0Count AS BYTE TRISC=3D%00000000 T1CON=3D%00111111 INTCON=3D%11000000 OPTION_REG.3=3D0 OPTION_REG.2=3D1 OPTION_REG.1=3D1 OPTION_REG.0=3D1 PIE1.0=3D1 PRINT $FE,1 : DELAYMS 30 ' Clear the LCD PRINT $FE,2 ' Set cursor at line 1,1 PRINT $FE,$0C ' Switch off cursor myStore=3D0 myInt=3D0 TMR0Count=3D0 MainLoop:=20 myTMR.Lowbyte =3D TMR1L myTMR.Highbyte =3D TMR1H GOSUB ShowVals=20 GOTO MainLoop ShowVals: CURSOR 1,1 PRINT "myInt: ", @myInt, " " CURSOR 2,1 PRINT "TMR0Count: ", @TMR0Count, " " RETURN IntCheck: CONTEXT SAVE IF PIR1.0=3D1 THEN GOTO IntTMR1 ENDIF IF INTCON.2=3D1 THEN GOTO IntTMR0 ENDIF GOTO IntExit IntTMR0: myInt=3DmyStore myStore=3D0 TMR0Count=3DTMR0Count+1 INTCON.2=3D0 GOTO IntExit IntTMR1: myStore=3DmyStore+1 PIR1.0=3D0 GOTO IntExit IntExit: CONTEXT RESTORE END -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads