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   00000000B       ; nastaveni portu na vstup nebo vystup
        movwf   PORTA           ; 1=vstup 0=vystup
        movlw   01000011B
        movwf   PORTB

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

        page0

        clrw                    ; vynulovani portu
        movwf   PORTA
        movwf   PORTB
        

MainLoop:
        movlw   255
        movwf   CT2
        movlw   252
        movwf   CT1
rozj:

        decf    CT1, f

        bsf     PORTA, 0        
        bcf     PORTA, 1        ;100
        bcf     PORTA, 2
        call    zap

        bsf     PORTA, 0        ;110
        bsf     PORTA, 1
        bcf     PORTA, 2
        call    zap

        bcf     PORTA, 0        ;010
        bsf     PORTA, 1
        bcf     PORTA, 2
        call    zap

        decfsz  CT2, f
        goto    ble
        goto    rychle

ble:    bcf     PORTA, 0        ;011
        bsf     PORTA, 1
        bsf     PORTA, 2
        call    zap

        bcf     PORTA, 0        ;001
        bcf     PORTA, 1
        bsf     PORTA, 2
        call    zap

        bsf     PORTA, 0        ;101
        bcf     PORTA, 1
        bsf     PORTA, 2
        call    zap

zap:    decfsz  
        
        movf    CT3, w
        movwf   xxx             ;xxx promena z delay.asm
        call    Delay1ms

;----------------------------------------------------
rychle:
        bsf     PORTA, 0        
        bcf     PORTA, 1        ;100
        bcf     PORTA, 2
        Delay   3

;       bsf     PORTA, 0        ;110
;       bsf     PORTA, 1
;       bcf     PORTA, 2
;       Delay   

        bcf     PORTA, 0        ;010
        bsf     PORTA, 1
        bcf     PORTA, 2
        Delay   3

;       bcf     PORTA, 0        ;011
;       bsf     PORTA, 1
;       bsf     PORTA, 2
;       Delay   2

        bcf     PORTA, 0        ;001
        bcf     PORTA, 1
        bsf     PORTA, 2
        Delay   3

;       bsf     PORTA, 0        ;101
;       bcf     PORTA, 1
;       bsf     PORTA, 2
;       Delay   2
        goto    rychle
;______________________________________________________________
        movlw   250
        movwf   ct2



        decfsz  ct2
        goto
        decfsz  ct3
        




        bcf     PORTA, 2
        bcf     PORTA, 1

smycka: 
        btfss   PORTB, 0
        goto    LEDon
        goto    smycka
LEDon:
        bsf     PORTA, 3        ;Rozsvit LED
        Delay   250             
        bcf     PORTA, 3        ;Zhasni LED
        Delay   250             
        goto    smycka
        ;--0-------------





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

        cblock  

        CT1
        CT2
        CT3
        CT4

        endc

        end