Device = 16F628A Declare Xtal 20.48 Declare LCD_DTPin PORTB.0 Declare LCD_ENPin PORTB.4 Declare LCD_RSPin PORTB.5 Declare LCD_Interface 4 Declare LCD_Lines 2 Dim Total As Dword Dim Timer As TMR1L.Word Dim Timer0 As Dword Dim Timer1 As Dword Dim Fout As Dword CMCON = 6 TRISA = %00000000 TRISB = %00000011 OPTION_REG = %00001000 T1CON = %00000111 INTCON = %10110101 Clear PIR1.0 Set PIE1.1 On_Interrupt GoTo ISR Cls Print At 1,1,"Primer" DelayMS 500 Cls GoTo Loop ISR: Context Save If INTCON.2 = 1 Then Dec Timer0 Clear INTCON.2 EndIf If Timer0 = 0 Then T1CON.0 = 0 If PIR1.0 = 1 Then Inc Timer1 Clear PIR1.0 EndIf Context Restore Retfie Loop: Timer0 = 10000 Timer1 = 0 Timer = 0 TMR0 = 0 T1CON.0 = 1 While T1CON.0=1: Wend Fout=Timer1*65536 Total=Fout+Timer If Total<=1000 Then Print At 1,1,Dec Total,"Hz " If Total>=1001 And Total<1000000 Then Print At 1,1,Dec Total/1000,".",Dec3 Total//1000,"KHz " If Total>999999 Then Print At 1,1,Dec Total/1000000,".",Dec6 Total//1000000,"MHz " DelayMS 100 GoTo Loop End