;
;    libr_ktp.txt      
;   
;
;--------------------------------------------------------------------
;
;  
;
;zumask   equ (1<<ZUM1 | 1<<ZUM0) ;   
;                  ;    
;
;cnt_zum  res 3 ;  
;zumout   res 1 ;       RA
;sni_buf  res 1 ;   
;sni_mask res 3 ;   
;
;tmm_zud     equ 5 ;    
;               ; cnt_zum+2    
;               ;    tmm_flags
;
;------------------------------------------------------------
zuumm
    movlw blok_ra
    movwf zumout
    bcf zumout,ZUM0 ;   
zud0
;    movlw 1
;    movwf cnt_zum+1
    movlw .200
    movwf cnt_zum
    movf zumout,w
    movwf PORTA
zud1
     decfsz cnt_zum,f
     goto zud1
;      decfsz cnt_zum+1,f
;      goto zud1
    movlw zumask
    iorwf zumout,w
    xorwf zumout,w ;     
    iorlw ~(1<<ZUM1 | 1<<ZUM0 | 1<<L_DN | 1<<L_SCL | 1<<L_CE)
    movwf zumout
   movf PORTB,w
   movwf sni_buf
   btfss sni_buf,L_Sn2
   goto off_zum ;      (L_Sn2=0)
   btfss tmm_flags,tmm_zud
    goto zud0
   decfsz cnt_zum+2,f
    goto zud0
   bcf tmm_flags,tmm_zud ;      cnt_zum+2
                ; 1-255  
off_zum
     movlw blok_ra
     movwf PORTA
  return
;
;--------------------------------------
; - 
; ~0,000001*256*39=0,0099 
tm_azvp
     movlw .10 ; .39
     movwf cnt_zum
     clrf cnt_zum+1
l_tazp
     decfsz cnt_zum,f
     goto l_tazp
      decfsz cnt_zum+1,f
      goto l_tazp
    return
;
;----------------------------------------------------------
;    (  CALL)
;    ( sfi_ktp.txt)
wit_h00
     call tm_azvp ;  
     movf PORTB,w
     andwf INDF,w
    return ;    Z
;----------------------------------------------------------
;    (  CALL)
;    ( sfi_ktp.txt)
wit_h01
     call tm_azvp ;  
      movf PORTB,w
     andwf INDF,w
     btfsc STATUS,Z
    goto wit_h01 ;  =1
     call tm_azvp ;  
      movf PORTB,w
     andwf INDF,w
     btfsc STATUS,Z
    goto wit_h01 ;  
   return
;----------------------------------------------------------
; 
adj_inc
      incf tmm_m_adj,f
      movlw tmm_m60
      xorwf tmm_m_adj,w
      btfss STATUS,Z
     return
      clrf tmm_m_adj
      incf tmm_h_adj,f
      movlw tmm_m24
      xorwf tmm_h_adj,w
      btfss STATUS,Z
     return
      clrf tmm_h_adj
    return
;----------------------------------------------------------
; 
adj_dec
      decf tmm_m_adj,f
      movlw mrak
      xorwf tmm_m_adj,w
      btfss STATUS,Z
     return
      movlw .59
      movwf tmm_m_adj
      decf tmm_h_adj,f
      movlw mrak
      xorwf tmm_h_adj,w
      btfss STATUS,Z
     return
      movlw .23
      movwf tmm_h_adj
    return
;
;----------------------------------------------------------
;