Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: my_leds.s
- Revision:
- 2:968db132481b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/my_leds.s Sat Jan 04 12:34:04 2020 +0000
@@ -0,0 +1,38 @@
+ AREA asm_demo, CODE, READONLY
+ EXPORT my_leds
+my_leds
+ PUSH {R1, R2, R3, R4, LR}
+ LDR R1, =0x2009C020 ; loading the base.
+ AND R4, R0, #8 ;take biggest bit
+ AND R3, R3, #0
+ ORR R3, R3, R4 ;put in R3
+ LSL R3, R3, #1 ;shift for spacing for pins
+ AND R4, R0, #6 ;take middle bits
+ ORR R3, R3, R4 ;put in R3
+ LSL R3, R3, #1 ;shift for spacing for pins
+ AND R4, R0, #1 ;take first bit
+ ORR R3, R3, R4 ;put in R3
+ LSL R3, R3, #18 ;shift to pin location in hex
+ STR R3, [R1, #0x18] ;turns on led with FIOSet
+
+ BL wait ; Call to wait
+ STR R3, [R1, #0x1C] ;clears LED with FIOClear
+ POP {R1, R2, R3, R4, LR}
+ BX LR
+ ALIGN ; End of my_leds function
+
+wait
+ PUSH {R1, R2}
+ MOV.W R1, #1
+ LDR R2, =5000000
+ ; Omitted loop code goes here
+loop_entry
+ CMP R1, R2
+ BGT loop_exit
+ ADD R1,R1, #1
+ B loop_entry
+loop_exit
+ POP {R1, R2}
+ BX LR ; Return from wait
+ ALIGN
+ END
\ No newline at end of file