Threads left open are useless to others, so I will post what I came up with.
This Works on the bench , I have yet to try it on the machine as I am still making parts for it.Code:@MyConfig = _HS_OSC & _LVP_OFF & _WDT_OFF & _CP_OFF @MyConfig = MyConfig & _BODEN_OFF & _MCLRE_ON & _PWRTE_ON @ __CONFIG MyConfig '===================== Set Defines =================================== '* DEFINE OSC 20 '==================== Set up registers =============================== ' INCLUDE "MODEDEFS.BAS" CMCON = 7 ' Shut off comparators TRISA = %00010000 ' Set PORTA to all outputs A.4 TRISB = %00000000 ' Set PORTB Outputs PortA = $20 ' Set all Port A outputs low PORTB = 0 ' Set all Port B outputs low ' '=====================Set Constants ================================ 'no constants as yet ' '===================== Alias Ports ================================= ' TacInput var PORTA.4 ' Input pin for T0CKI - Tach In ' SDO VAR PortB.0 ' 7 Segment Data Out SCLK var PortB.1 ' 7 Segment Clock Out DLE var portB.2 ' 7 Segment Latch Enable '===================== Declare Variables ============================= Digit_1 var byte ' Thousands digit Digit_2 var byte ' Hundreds digit Digit_3 var byte ' Tens digit Digit_4 var byte ' Units digit DIGIT_OUTPUT VAR BYTE ' Storage for each digit before lookup CounterTotal var word ' Someplace to count input pulses Displays VAR WORD ' Storage while Countertotal gets cleared '===================== Zero Digits ==================================== Digit_1 = 0 Digit_2 = 0 Digit_3 = 0 Digit_4 = 0 '===================== EEPROM DATA =================================== DATA @ 0,126,48,109,121,51,91,95,112,127,123 'DIGITS WITHOUT DECIMAL ;DATA @ 10,254,176,237,249,179,219,223,240,255,243 'DIGITS WITH DECIMAL '=========================== Main Loop ============================== LOOP: COUNT PortA.4,1000,CounterTotal ' DISPLAYS=0 DISPLAYS=(DISPLAYS+CounterTotal) ' load OverflowTotal into displays displays=(displays*60) ' change this formula to agree with encoder ' Formula is for 1 PPR, 30 for 2 PPR, 15 for 4 PPR ' 10 for 6 PPM, ET-AL, OR TURN THEM AROUND 2 FOR 30 ' 3 for 20,4 for 15,5 for 12, 6 for 10 gosub Display CounterTotal=0 ' GOTO LOOP ' '=========================== Subroutines ============================ Display: ' DIGIT_OUTPUT = DISPLAYS dig 0 ' Load Thousands Digit READ DIGIT_OUTPUT, DIGIT_1 ' Convert and Load Thousands Variable DIGIT_OUTPUT = DISPLAYS DIG 1 ' Load Hundreds Digit READ DIGIT_OUTPUT, DIGIT_2 ' Convert and Load Hundreds Variable DIGIT_OUTPUT = DISPLAYS DIG 2 ' Load Tens of Units Digit READ DIGIT_OUTPUT, DIGIT_3 ' Convert and Load Tens Variable DIGIT_OUTPUT = DISPLAYS dig 3 ' Load Ones of Units Digit READ DIGIT_OUTPUT, DIGIT_4 ' Convert and Load Units Variable ' shiftout SDO,SCLK,4,[DIGIT_1\8,DIGIT_2\8,DIGIT_3\8,DIGIT_4\8] pulsout DLE, 500 pause 125 ' return ' END




Bookmarks