Browse Source

Transférer les fichiers vers 'ASM/signal_carre'

Jdihadi Ahamdy 1 year ago
parent
commit
fc2d85d218
1 changed files with 40 additions and 12 deletions
  1. 40
    12
      ASM/signal_carre/signal.s

+ 40
- 12
ASM/signal_carre/signal.s View File

@@ -1,26 +1,54 @@
1 1
 	thumb
2
+		
3
+	area mesdata, data, readwrite;	déclaration d'une zone pour vriable 
4
+FLAG DCD 0	;initialisation d'une vaiable flag cf TD
5
+		
2 6
 	area moncode, code, readonly
7
+	export timer_callback
8
+		
3 9
 		
4 10
 GPIOB_BSRR	equ	0x40010C10	; Bit Set/Reset register
5 11
 
6 12
 ;fonction principale
7 13
 timer_callback proc
8
-	ldr r3, =GPIOB_BSRR
9
-	ldr r1, [r3]
10
-	cbz r1, mise_a_1
11
-	cbnz r1, mise_a_0
14
+	
15
+; r0 = FLAG	
16
+; r1 = valeur du FLAG 
17
+; r2 = la valeur a 2
18
+; r3 = adreess GRPIOB_BSRR
19
+
20
+	ldr 	r0, =FLAG
21
+	
22
+	ldr 	r1, [r0]
23
+	cbz 	r1, mise_a_1
24
+	cbnz 	r1, mise_a_0
12 25
 	endp
26
+		
13 27
 
14 28
 
15 29
 ; mise a 1 de PB1
16
-mise_a_1 proc
17
-	ldr	r3, =GPIOB_BSRR
18
-	mov	r1, #0x00000002
19
-	str	r1, [r3]
30
+mise_a_1 
31
+	ldr		r3, =GPIOB_BSRR
32
+	mov		r2, #0x00000002
33
+	str		r2, [r3]
34
+	
35
+	;Mise a 1 du flag
36
+	mov 	r1, #0x1
37
+	str 	r1,[r0]
38
+	bx		lr
39
+	
20 40
 	
21
-mise_a_0 proc
41
+mise_a_0 
22 42
 ; mise a zero de PB1
23
-	ldr	r3, =GPIOB_BSRR
24
-	mov	r1, #0x00020000
25
-	str	r1, [r3]
43
+	ldr		r3, =GPIOB_BSRR
44
+	mov		r2, #0x00020000
45
+	str		r2, [r3]
46
+	
47
+	;Mise a 0 du flag
48
+	mov 	r1, #0x0
49
+	str		r1,[r0]
50
+	bx		lr
51
+	
52
+	endp 
53
+	end
26 54
 ; N.B. le registre BSRR est write-only, on ne peut pas le relire

Loading…
Cancel
Save