Retour Page PIC

; programe qui permet defaire clignoter une LED
; sur le port B0
; sans utiliser les interruptions et le TIMER TMR0

#include <p16F84.inc>

timed equ H'ff'
compt_1 equ 0C
compt_2 equ 0D
compt_3 equ 0E
compt_4 equ 0F

ORG 0x00 ; processor reset vector
goto main

wait: nop
decfsz compt_1,1
goto wait
movlw 020
movwf compt_1
decfsz compt_2,1
goto wait
movlw 020
movwf compt_1
movlw 020
movwf compt_2

return


wait2: nop
decfsz compt_3,1
goto wait2
movlw 050
movwf compt_3
decfsz compt_4,1
goto wait2
movlw 050
movwf compt_3
movlw 050
movwf compt_4

return

main: nop

movlw 020
movwf compt_1
movlw 020
movwf compt_2

movlw 050
movwf compt_3
movlw 050
movwf compt_4

movlw 0
TRIS PORTB

movlw B'00000001'
movwf PORTB
call wait

movlw B'00000000'
movwf PORTB
call wait

movlw B'00000001'
movwf PORTB
call wait

movlw B'00000000'
movwf PORTB
call wait2

movlw B'00000001'
movwf PORTB
call wait

movlw B'00000000'
movwf PORTB
call wait2


goto main

fin: nop ; boucle de fin attente d'interruption
goto fin


END ; directive 'end of program'