;********************************************************************* ; File: 00_ISR_LiIon.INC ; Author: Ottmar ; Date: 21.05.2022 ;********************************************************************* isr_tmr0: CTRL_LEDOFF ;ISR-Widerholrate = 10ms ;INTCON,GIE is automatically cleared ;WREG, STATUS, PCLATH are automatically saved ; bcf INTCON,TMR0IF ;b2=0 overflow flag is cleared movlw .100 movwf TMR0 ;Preset TMR0 after 100 overflow cycles ; isr_debounce: ;needs 15 cycles ; Take over current button state into the debounce routine movf KEY_PORT,w ;select only input-Port-pins (push buttons) andlw KEY_MASK movwf KeyState ;the actual state of inputs ; comf KeyState,w ; Increment the vertical counter movf cnt1,W xorwf cnt0,F comf cnt1,F ; See if any changes occurred movf KeyState,W xorwf KeyPress,W ; Reset the counter if no change has occurred andwf cnt1,F andwf cnt0,F ; Determine the counter's state movf cnt1,W iorwf cnt0,W ; Clear all bits that are filtered-or more accurately, save ; the state of those that are being filtered andwf KeyPress,F xorlw 0xff ; Re-write the bits that haven't changed. andwf KeyState,W iorwf KeyPress,F ;the debounced keybits are LOW as long as ; ;the button is down. isr_cnt: decf cnt10ms,f ;Instruction Descriptions S.329 btfss STATUS,Z ;Z=1? cnt10ms=0? 1 sec finished? GOTO isr_end ;NO jump over set counter & new sec movlw .100 ; preset counter movwf cnt10ms ;---------------------------- ;Bit Flags,NEW_SEC wechselt von 0->1->0 time 1-1 = 2xISR-Interval clrw bsf WREG,NEW_SEC ;universeller als movlw b'01000000' xorwf Flags,f; ; btfss Flags,NEW_SEC ;Flag is used to refresh LCD-Data GOTO isr_end ;each second bsf Flags,NEW_SEC CTRL_LEDON ; isr_sec: ; incf Esec,f ;Increase time each new second movlw .10 subwf Esec,w btfss STATUS,Z GOTO isr_end ; clrf Esec incf Zsec,f ;10 Sekunden erhöhen movlw D'6' subwf Zsec,w btfss STATUS,Z GOTO isr_end ;10 Sekunden <> 6 ; clrf Zsec incf Emin, f ;1 Minuten erhöhen movlw D'10' subwf Emin, w btfss STATUS, Z goto isr_end ;1 Minuten <> 10 ; clrf Emin incf Zmin, f ;10 Minuten erhöhen movlw D'6' subwf Zmin, w btfss STATUS, Z goto isr_end ;10 Minuten <> 6 ; clrf Zmin incf Estd, f ;1 Stunden erhöhen movlw D'10' subwf Estd, w btfss STATUS, Z goto isr_end ; clrf Estd incf Zstd,f ;10 Stunden erhöhen isr_end: RETFIE ;*********************************************************************