Go to most recent revision | Blame | Last modification | View Log | Download
#include 16C84.INC
PRYJM EQU 0 ;portb
org 0
goto Start
;--------------------
org 4
;--------------------
goto Start
#include delay.asm
Start:
page1
movlw 00101000B ; inicializace citace a prescaleru
movwf TMR0
movlw 00000000B ; konfigurace preruseni
movwf INTCON
page1
movlw 11110111B ; 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:
btfss PORTB, PRYJM ;cekani na impuls1
goto MainLoop
call Delay10us
call Delay10us
btfss PORTB, PRYJM ;potvrzeni impulsu1
goto MainLoop
call Delay10us
call Delay10us
smycka:
btfsc PORTB, PRYJM
goto smycka
;sinchronizace
call Delay10us
smycka1: ;2impuls
btfss PORTB, PRYJM
goto smycka1
call Delay10us
smycka2:
btfss PORTB, PRYJM
goto MainLoop
mezera2:
btfsc PORTB, PRYJM
goto mezera2
impuls3:
btfss PORTB, PRYJM
goto impuls3
mezera3:
btfsc PORTB, PRYJM
goto mezera3
call Delay10ms
clrf TMR0
Delay
;-------------------------
;----------------------------
; Definice promenych
;----------------------------
cblock
CT1
CT2
endc
end