TP2 Organigramme

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

TP2_organigramme.

notebook January 03, 2021

Solution 1

Main

PORTC=0
Main
CLRF PORTC
Compt=100
Label1

LED_Blink
MOVLW 100
MOVWF Compt
Compt=Compt­1 Label2
Call LED_Blink

Non DECFSZ Compt,1


Compt=0
Goto Label2
?
INCF PORTC,1
Oui
MOVLW 10
PortC ++
SUBWF PORTC,0
BTFSC STATUS,Z
Non CLRF PORTC
PortC>9
? Goto Label1

Oui
PortC=0

Solution 2

Main

PORTC=0

Main
Compt=0
CLRF PORTC

LED_Blink CLRF Compt


Label
Compt ++ Call LED_Blink
INCF Compt,1

Non MOVLW 100


Compt=100
?
SUBWF Compt,0
BTFSS STATUS,Z
Oui
Goto Label
Compt=0
CLRF Compt
INCF PORTC,1
PortC ++
MOVLW 10
SUBWF PORTC,0
Non
PortC>9 BTFSC STATUS,Z
? CLRF PORTC
Oui Goto Label
PortC=0

Tajeddin Elhamadi 1
TP2_organigramme.notebook January 03, 2021

Routine LED_Blink

LED_Blink

LED ON #Define LED PORTB,RB1


LED_Blink
Tempo_500 ms BSF LED
Call Tempo
LED OFF BCF LED
Call Tempo
Return
Tempo_500 ms

Return

Temporisation 500 ms avec un osc=20MHz (div=64)

Tempo

N=156 N EQU 0x20


Tempo

TMR0=6 MOVLW 156


MOVWF N
Loop1
Non
TMR0=0 MOVLW 6
? MOVWF TMR0
Oui Loop2
MOVF TMR0,w
N=N­1
BTFSS STATUS,Z
goto Loop2

Non DECFSZ N,1


N=0
?
goto Loop1
Return
Oui

Return

Tajeddin Elhamadi 2

You might also like