Subversion Repositories svnkaklik

Rev

Blame | Last modification | View Log | Download

#include 16C84.INC



        org     0

        goto    Start
        ;--------------------
        org     4
        ;--------------------
        goto    Start

#include Delay.asm

Start:
        page1
        movlw   00000000B       ; inicializace citace a prescaleru
        movwf   TMR0
        movlw   00000000B       ; konfigurace preruseni
        movwf   INTCON

        page1
        movlw   11110011B       ; nastaveni portu na vstup nebo vystup
        movwf   PORTA           ; 1=vstup 0=vystup
        movlw   11110001B
        movwf   PORTB

        bsf     TMR0, 7         ; vypni pull-up na PORTB (OPTION registr)

        page0

        clrw                    ; vynulovani portu
        movwf   PORTA
        movwf   PORTB

        bsf     PORTA, 3        ; Pull-Up na tlacitka

        bcf     PORTB, 1        ; zhasnuti LED
        bcf     PORTB, 2
        bcf     PORTB, 3

MainLoop:
        ;movlw  2
        ;movwf  volani          ; Nastavi pocet volani procedury vybito 
        ;bsf    PORT            ; Nabiti kondenzatoru1
        ;bsf    PORT            ; Nabiti kondenzatoru2
dal:
        ;btfss  PORTA, 1        ; Test kondenzatoru1
        ;call   vibito
        bsf     PORTB, 3
        bsf     PORTB, 4
        Delay   100
        ;bsf    PORTA, 3
        ;Delay  250
        ;bcf    PORTA, 3

        bsf     PORTA, 2
        Delay   250
        bcf     PORTA, 2

        Delay   250
        Delay   250
        Delay   250
        Delay   250
        Delay   250

        bsf     PORTA, 2
        Delay   250
        bcf     PORTA, 2

        ;bsf    PORTA, 3
        ;Delay  250
        bcf     PORTA, 3
 
        bcf     PORTB, 3
        bcf     PORTB, 4
        Delay   250
        ;btfss  PORTB, 6        ; Test kondenzatoru2
        ;call   vibito
        ;incf   Ramec, f
        ;goto   dal
        goto    MainLoop
        ;---------------


Sinchro:
        ;bsf    PORTB, 1
        ;call   Delay10us               
        ;call   Delay10us       
        ;call   Delay10us       
        ;bcf    PORTB, 1                ; 1. impuls (30ms)
        ;call   Delay10us
        ;call   Delay10us
        ;call   Delay10us               
        ;bsf    PORTB, 1
        ;call   Delay10us               
        ;call   Delay10us       
        ;bcf    PORTB, 1                ; 2. impuls (20ms)
        ;call   Delay10us
        ;call   Delay10us                       
        ;bsf    PORTB, 1
        ;call   Delay10us               
        ;bcf    PORTB, 1                ; 3. impuls (10ms)
        ;call   Delay10us
        
        ;return

        ;-------------------------
Protokol:
        movlw   8
        movwf   Bity                    ; nastaveni slova
        call    Sinchro
VysBit:
        btfss   Ramec, 0
        call    frek0
        call    frek1
Rotace:
        rrf     Ramec, f
        decfsz  Bity, f
        goto    VysBit
        return

        ;-------------------------
frek0:
                                        ; 2000 Hz       45 impulsu      
        
        ;-------------------------
frek1:  
                                        ; 1500 Hz       60 impulsu
        ;-------------------------
vibito:
        movlw   4
        movwf   CT1                             ; uvolneni mista
zapis:  
        rlf     Ramec, f
        decfsz  CT1, f
        goto    zapis
        decfsz  volani, f
        return
        call    Protokol
        call    MainLoop


;----------------------------
; Definice promenych
;----------------------------

        cblock  

        Bity
        Ramec
        volani
        XXX

        endc

        end