Blame | Last modification | View Log | Download
#include 16C84.INC
org 0
goto Start
;--------------------
org 4
;--------------------
Start:
page1
movlw 00000000B ; inicializace citace a prescaleru
movwf TMR0
movlw 00000000B ; konfigurace preruseni
movwf INTCON
page0 ; inicializace portu
movlw 0
movwf PORTA
movwf PORTB
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:
movlw 10 ; 10 ms
movwf DELAY1
call delay1ms
bsf PORTB, 3 ; ON
movlw 100 ; 100 * 5us = 0,5 ms
btfss PORTA, 1 ; Test TL1
movlw 200 ; 200 * 5us = 1 ms
btfss PORTB, 6 ; Test TL2
movlw 1 ; 1 * 5us = 0,005 ms
movwf DELAY5
call delay5us
movlw 1 ; 1 ms
movwf DELAY1
call delay1ms
bcf PORTB, 3 ; OFF
goto MainLoop
bcf PORTB, 2 ; zhasnuti LED
bcf PORTB, 1
btfss PORTA, 1 ; Test TL1
bsf PORTB, 2 ; rozsviceni LED2
btfss PORTB, 6 ; Test TL2
bsf PORTB, 1 ; rozsviceni LED2
goto MainLoop
;---------------
#include SERVO.INC
#include DELAY.INC
end