utilisation et gestion du compteur de programme program counter (pc) et de la pile ( stack )

29
30 Tempo_50ms movlw d’50’ 31 movwf Cmpt_50ms 32 Loop_50ms call Tempo_1ms 33 decfsz Cmpt_50ms,f 34 goto Loop_50ms 35 return 20 movlw d’10’ 21 movwf Compteur 22 Attend call Tempo_50ms 23 decfsz Compteur,f 24 goto Attend 25 movf Consigne,w 26 sublw d’5’ 27 btfsc STATUS,Z 28 goto Alarme 40 Tempo_1ms movlw d’249’ 41 movwf Cmpt_1ms 42 Loop_1ms nop 43 decfsz Cmpt_1ms,f 44 goto Loop_1ms 45 return Appels de sous-programmes Programme principal Sous-programmes EPAI Fribourg / Hervé Pag Pile PC 21 Utilisation et gestion du compteur de programme Program Counter (PC) et de la pile (Stack) Lors du déroulement d’un programme Lors de l’appel d’un sous-programme Lors d’une interruption

Upload: holleb

Post on 10-Jan-2016

29 views

Category:

Documents


2 download

DESCRIPTION

Utilisation et gestion du compteur de programme Program Counter (PC) et de la pile ( Stack ) Lors du déroulement d’un programme Lors de l’appel d’un sous-programme Lors d’une interruption. avec interruptions. Interruptions. avec interruptions. Interruptions. avec interruptions. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC PilePC

21

Utilisation et gestion

du compteur de programmeProgram Counter (PC)

et de la pile (Stack)

• Lors du déroulement d’un programme

• Lors de l’appel d’un sous-programme

• Lors d’une interruption

Page 2: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC PilePC

22

Page 3: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

23

PilePC

30

Pile

23

Page 4: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC Pile

23

PC

31

Page 5: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

32

Pile

23

Page 6: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

33

Pile

23

PC

40

Pile

33

23

Page 7: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

41

Pile

33

23

Page 8: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

42

Pile

33

23

Page 9: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

43

Pile

33

23

Page 10: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

44

Pile

33

23

Page 11: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

45

Pile

33

23

PC

42

Page 12: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

43

Pile

33

23

Page 13: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

44

Pile

33

23

PC

45

Page 14: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

46

Pile

33

23

PC

33

Pile

23

Page 15: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

34

Pile

23

PC

35

Page 16: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

36

Pile

23

PC

23

Pile

Page 17: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

24

PilePC

25

Page 18: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

26

Pile

Page 19: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

27

Pile

Page 20: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

PC

28

Pile

Page 21: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

avec interruptions

04 bsf L_ALARME

05 call Tempo_3s

06 bcf L_ALARME

07 retfie

Interruptions

PC

41

Pile

33

23

PC

04

Pile

41

33

23

Page 22: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

04 bsf L_ALARME

05 call Tempo_3s

06 bcf L_ALARME

07 retfie

Interruptions

PC

05

Pile

41

33

23

avec interruptions

Page 23: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

04 bsf L_ALARME

05 call Tempo_3s

06 bcf L_ALARME

07 retfie

Interruptions

PC

06

Pile

41

33

23

PC

50

Pile

06

41

33

23

avec interruptions

Page 24: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

04 bsf L_ALARME

05 call Tempo_3s

06 bcf L_ALARME

07 retfie

Interruptions

PC

06

Pile

41

33

23

PC

50

Pile

06

41

33

23

avec interruptions

Page 25: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

04 bsf L_ALARME

05 call Tempo_3s

06 bcf L_ALARME

07 retfie

Interruptions

PC

07

Pile

41

33

23

avec interruptions

Page 26: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

04 bsf L_ALARME

05 call Tempo_3s

06 bcf L_ALARME

07 retfie

Interruptions

PC

08

Pile

41

33

23

Pile

33

23

PC

41

avec interruptions

Page 27: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

04 bsf L_ALARME

05 call Tempo_3s

06 bcf L_ALARME

07 retfie

Interruptions

PC

42

Pile

33

23

avec interruptions

Page 28: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

04 movwf W_temp

05 swapf STATUS,w

06 bcf STATUS,RP0

07 movwf Satus_temp

08 bsf L_ALARME

09 call Tempo_3s

10 bcf L_ALARME

11 swapf Status_temp,w

12 movwf STATUS

13 swapf W_temp,f

14 swapf W_temp,w

15 retfie

InterruptionsSauvegardedu contexte

Restitutiondu contexte

avec interruptions

PilePC

Page 29: Utilisation et gestion  du compteur de programme Program  Counter   (PC) et de la pile ( Stack )

30 Tempo_50ms movlw d’50’

31 movwf Cmpt_50ms

32 Loop_50ms call Tempo_1ms

33 decfsz Cmpt_50ms,f

34 goto Loop_50ms

35 return

20 movlw d’10’

21 movwf Compteur

22 Attend call Tempo_50ms

23 decfsz Compteur,f

24 goto Attend

25 movf Consigne,w

26 sublw d’5’

27 btfsc STATUS,Z

28 goto Alarme

40 Tempo_1ms movlw d’249’

41 movwf Cmpt_1ms

42 Loop_1ms nop

43 decfsz Cmpt_1ms,f

44 goto Loop_1ms

45 return

Appels de sous-programmes

Programme principal Sous-programmes

EPAI Fribourg / Hervé Page

04 movwf W_temp

05 swapf STATUS,w

06 bcf STATUS,RP0

07 movwf Satus_temp

08 call Int_rb0

09 swapf Status_temp,w

10 movwf STATUS

11 swapf W_temp,f

12 swapf W_temp,w

13 retfie

Interruptions

avec interruptions

PilePC