Documente Academic
Documente Profesional
Documente Cultură
;
; 877-led.asm
;********************************************************
list p=PIC16F877A
include p16f877A.inc
__config _hs_osc & _wdt_off & _pwrte_on & _lvp_off
errorlevel -302 ;Suppress bank warning
cblock h'20'
ctr0
ctr1
ctr2
;myvar2
; ...
endc
delay500ms:
movlw 10 ;(50)*(49802+3)+5=50305 tcyc=249.255ms
movwf ctr2
call delay10ms
decfsz ctr2,f
goto $-2 ;
;call delay kalan
return
delay10ms:
movlw 99 ;(99)*(500+5)+5=50305 tcyc=49.802ms
movwf ctr1
call delay100us
decfsz ctr1,f
goto $-2 ;
return
delay100us: ;20Mhz,tclk=0.05us,Tcyc=0.2us
movlw 99 ;(n-1)*5+10 including the call instr.
movwf ctr0
nop ;$-3
nop
decfsz ctr0,f
goto $-3 ;
return
end