0,0 → 1,95 |
#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 |
|
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: |
;prodleva 10ms |
|
movlw 250 ; 2,5 ms |
movwf CT10 |
call Delay10us |
movlw 250 ; 2,5 ms |
movwf CT10 |
call Delay10us |
movlw 250 ; 2,5 ms |
movwf CT10 |
call Delay10us |
movlw 250 ; 2,5 ms |
movwf CT10 |
call Delay10us |
|
bsf PORTB, 1 ; ON |
|
movlw 150 |
|
btfss PORTA, 1 ; Test TL1 |
movlw 100 |
|
btfss PORTB, 6 ; Test TL2 |
movlw 200 |
|
movwf CT10 |
call Delay10us |
|
bcf PORTB, 1 ; OFF |
|
|
bcf PORTB, 2 ; zhasnuti LED |
bcf PORTB, 3 |
|
btfss PORTA, 1 ; Test TL1 |
bsf PORTB, 2 ; rozsviceni LED2 |
|
btfss PORTB, 6 ; Test TL2 |
bsf PORTB, 3 ; rozsviceni LED2 |
|
goto MainLoop |
;--------------- |
|
Delay10us: ; Prodleva (DELAY10 * 10us)+3us |
nop |
nop |
nop |
nop |
nop |
nop |
nop |
decfsz CT10, 1 |
goto Delay10us |
return |
|
#include SERVO.INC |
|
end |