The RPM code works great. I changed a few things around like the scaler configs to work with a V-8. I incorporated it into the other code I have that also uses the elapsed time code. When I compile I got an error centered around DEFINE INTHAND CCP_INT. So I looked in the elapsed-18-t3con.bas file and it has Define INTHAND _ClockCount I did some research on the forums and found I can used INTLHAND. Apparently I am defining two high priority interrupt handlers and that is a no-no. So I changed the line to Define INTLHAND _ClockCount . From what I have learned the LHAnd is another interrupt handler with a lower priority.

I have changed the Elapsed code to use T3 and also go to the thousandths of a second. It worked fine separately too. The code is on the next post.

When I start the timer, apparently the code goes into a loop on the elasped time code. If I don't start the timer, the code progresses to the next line of code and beyond. I have tried changing around the INTLHAND and INTHAND but same result.

Code:
Start           var     PortB.0
OnOff           var     PortB.1    'Input to start timers
Dig4            Var     PortB.2
Reset           var     PortB.3    
SOR             VAR     PortC.7    'Shift Over-Ride
Dig1            Var     PortC.0
Dig2            var     PortA.0
Dig3            var     PortA.1
Up1             var     PortA.3    'Up button to change seconds
Down1           var     PortA.2    'Down button to change seconds. 
Up001           var     PortE.0    'Up button to change tenths of second. 
Down001         var     PortE.1    'Down button to change tenths of second. 
Up01            var     PortA.4    'Up button to change hundredths of a second
Down01          var     PortA.5    'Down button to change hundredths of a second
Tool            var     PortB.4    'Button to change to diffent menu
UpStage         var     PortD.0    'Button to change stages
DownStage       var     PortC.3    'Button to change stages
LCD             VAR     PortC.6    'LCD output
RPMInput        var     PortC.2
Gate1           Var     PortC.1
Gate2           var     PortD.1
Gate3           var     PortD.2
Gate4           var     PortD.3
Gate5           var     PortD.6
Gate6           var     PortD.7
Gate7           var     PortD.5
Gate8           var     PortD.4  
StageCounter    var     byte
OnOffType       var     Bit            'Toggles between On/Off part of a Stage
ETorRPM         var     Bit
EditStage       var     byte


TotalTime       var     word      'Holds seconds and tics 

Active          var     bit
Prefix          con      $FE             ' needed before each command
LcdCls          CON      $51             ' clear LCD (use PAUSE 5 after)
LcdLine1        CON      $00             ' move cursor to line 1
LcdLine2        con      $40             ' move curson to line 2
LcdLine3        con      $14             ' move curson to line 3
lcdLine4        con      $54             ' move curson to line 4
LcdCol1         con      $00             ' move cursor to column 1
LcdCol2         con      $07             ' move cursor to column 7
Backlight       con      $53             ' Backlighting 1-8
CursorPS        con      $45             'Cursor Position
CursorOn        con      $47             'Cursof On
CursorOff       con      $48             'Cursor Off

Symbol Capture = PIR1.2   ' CCP1 capture flag
SYMBOL CapIE = PIE1.2     ' CCP1 interrupt enable bit
SYMBOL CapPriEn = IPR1.2  ' priority enable bit for CCP1 interrupt
SYMBOL PriEnable = RCON.7 ' set to enable priority levels on interrupts
TS     VAR WORD BANKA SYSTEM ' 1st capture value
PW     VAR WORD BANKA SYSTEM ' 2nd capture value & ultimately final pulse width
CF     VAR BYTE BANKA SYSTEM ' indicates when last capture is ready
RPM    var word BANKA SYSTEM 
Period var word BANKA SYSTEM 
define CODE_SIZE 32
define osc 20
DEFINE INTHAND CCP_INT    ' declare high-pri interrupt handler

Capture_Loop = 0
CLEAR                ' clear RAM on POR
TRISC.2 = 1          ' CCP1 input pin (Capture input on 18F242)
INTCON = 0           ' Interrupts off for now

INTCON2.7 = 0 'Pull Ups enabled
ADCON0 =0
ADCON1.3=1
ADCON1.2=1
ADCON1.1=1
ADCON1.0=1
TRISE.0=1
TRISE.1=1

'---------Display Start-Up Info-------
Include "Elapsed-18-T3CON.bas"
Include "modedefs.bas"	' Mode definitions for Serout

Pause 200
gosub ClearScreen	
pause 100
GOTO Init 
ASM
CCP_INT
  BTFSS CCP1CON,0      ; capture from rising edge?
  BRA Fall             ; no .. goto falling edge
  MOVFF CCPR1L, TS    ; get low capture byte into T1
  MOVFF CCPR1H, TS+1   ; get high capture byte into T1
  BRA IntExit          ; outta here
Fall
  MOVFF CCPR1L, PW     ; get low capture byte into PW
  MOVFF CCPR1H, PW+1   ; get high capture byte into PW
  BSF CF,0             ; indicate last capture
IntExit
  BTG CCP1CON,0        ; toggle between rising/falling edge captures
  BCF PIR1,2           ; clear capture interrupt flag bit
  RETFIE FAST          ; return/restore W, STATUS and BSR
ENDASM
    
Init: ' initialize a few things first
CCP1CON = %00000110  ' Capture mode, capture on rising edge
T1CON.7=1     'enable timer  16 bit `   
T1CON.6=1     'Timer1 OSC
T1CON.5=1     '1:4 prescaler
T1CON.4=0     '1:4 prescaler
T1CON.3=0     'Timer1 OSC off
T1CON.2=0     'sychro clock
T1CON.1=0     'internal clock
TMR1H = 0            ' Clear high byte of TMR1 counter
TMR1L = 0            ' Clear low byte
PriEnable = 1        ' enable priority levels on interrupts
Capture = 0          ' clear capture flag bit
CapPriEn = 1         ' set CCP1 int to high priority
CapIE = 1            ' enable the CCP1 capture interrupt
INTCON = %11000000   ' global + peripheral ints enabled
T1CON.0 = 1          ' Turn TMR1 on here

Gosub ResetTime

'---------Pre Run Routine------------------------------
PreRun:
  Repeat
  Serout2 LCD, 84, [Prefix,CursorPS,64,"Ready ", DEC5 RPM]  
    gosub Tach
    Gosub Shift
   Until Start = 0 and OnOff = 0 
  '-----------Run Routine--------------------------     
  
  While Start = 0 and OnOff = 0
   PrvOnOffType=0
  wend
  Active = 1
  Run: ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  
  While Start=0 and OnOff = 1 '''''!!!!!!!!!!!!!!!
  
    If Active = 1 then
      Gosub StartTimer
    endif
    Serout2 LCD,84,[Prefix,CursorPS,71,"test "]', #Stage3TOn]
''''Code doesn't make it this far. If I comment out 'gosub startimer' it makes it to this line. 
    Gosub Calc_TotalTime
Wend
    gosub Tach