Hello, I would to modify the source in order to be able to count single short event pulses up to 1kHz repetition. At the moment it is restricted to 25 Hz (did not understand yet how) The code example is here: EVENT: call RESETE ;reset required working bytes, and set screen movlw 100 ;initial basic CLKCNT val for secs timing movwf CLKCNT EVNT2: btfsc PORTA,3 ;is MODE switch pressed? goto ROUTE ;yes btfsc PORTA,4 ;is RESET still pressed? goto EVNT2 ;yes comf PORTB,W ;is RB6/RB7 high (depending on MASK)? andwf MASK,W btfsc STATUS,Z goto EVNT2 ;yes bcf INTCON,2 ;no, so clear timer flag and start timing INTRPT: ;working interrupt routine for event counting btfss INTCON,2 ;has a timer time-out been detected? goto INTRPT ;no bcf INTCON,2 ;yes (NB, max input rate via this route is 25Hz) call CLKIN btfsc PORTA,3 ;is MODE switch pressed? goto ROUTE ;yes btfsc PORTA,4 ;is reset needed? goto EVENT ;yes TSTBT1: comf PORTB,W ;is RB7/RB6 high andwf MASK,W btfss STATUS,Z goto TSTPRV ;yes bcf TSTFLG,7 ;no, clear data flag goto INTRPT TSTPRV: btfsc TSTFLG,7 ;is data flag high? goto INTRPT ;yes bsf TSTFLG,7 ;no, set data flag high incf COUNT1,F ;inc count btfss STATUS,Z goto TSTBT4 incf COUNT2,F btfss STATUS,Z goto TSTBT4 incf COUNT3,F TSTBT4: call DISPLY goto INTRPT The full code is here: ftp.epemag.wimborne.co.uk/pub/PICS/eventcounter The P16F84A ports are: RB6,RB7 - inputs RB0-RB3 - D4-D7 on the LCD RB4 - RS RB5 - E RA2-RA4 input buttons clock 3,2768 MHz I will strongly appreciate any help and advice how to modify the code, in order to detect short event pulses, (durattion in microseconds) Thank you for the understanding and kind support Best Regards Pavlik -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist