Subversion Repositories svnkaklik

Compare Revisions

Ignore whitespace Rev 385 → Rev 6

/programy/ASM/blik/DELAY.$$$
0,0 → 1,57
;--- Macro na spozdeni 1ms az 255ms ---
Delay macro ms
movlw ms
movwf CT2
call Delay1ms
endm
 
;--- Macro na spozdeni 0,1ms az 2,5ms (10-250) ---
Delay01 macro us
movlw us
movwf CT1
call us10
nop
nop ; Z duvodu vyrovnani poctu potrebnych taktu jako na Delay1ms
nop
return
endm
;--- Spozdeni v nasobcich 1ms+2us ----
 
Delay1ms:
movlw 99 ; 1 ms
movwf CT1 ; goto 2 takty decfsz 1 kdyz 1 jinak 2
call us10
 
decfsz CT2, f
goto Delay1ms
nop
;---------------------------------
return ;2us
 
;--- Spozdeni v nasobcich 10us ----
us10: ; Prodleva (CT1 * 10us)
nop
nop
nop
nop
nop
nop
nop
decfsz CT1, f
goto us10
nop
return
;-------------------------
 
;----------------------------
; Definice promenych
;----------------------------
 
cblock
 
CT1
CT2
 
endc
 
/programy/ASM/blik/OVLAD.$$$
0,0 → 1,147
#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 CT1
movlw 252
movwf CT2
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:
movf CT1, 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
;______________________________________________________________
 
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
;---------------
 
 
 
 
 
;----------------------------
; Definice promenych
;----------------------------
 
cblock
 
CT1
CT2
 
endc
 
end