ARM assembly language to control LEDs
Fork of ECE_4180_Lab1_P1_Arm by
Revision 1:1d27be3b634d, committed 2016-11-06
- Comitter:
- jboettcher
- Date:
- Sun Nov 06 22:36:01 2016 +0000
- Parent:
- 0:94cb0da877bc
- Commit message:
- complete;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
my_asm.s | Show annotated file Show diff for this revision Revisions of this file |
diff -r 94cb0da877bc -r 1d27be3b634d main.cpp --- a/main.cpp Wed Sep 07 20:54:08 2016 +0000 +++ b/main.cpp Sun Nov 06 22:36:01 2016 +0000 @@ -18,15 +18,8 @@ } else { value = 0; } - - - // loop forever - //call assembly language function to control LED1 my_asm(value); - //API function to control LED4 - // myled4 = value; - // flip value and wait wait(0.2); }
diff -r 94cb0da877bc -r 1d27be3b634d my_asm.s --- a/my_asm.s Wed Sep 07 20:54:08 2016 +0000 +++ b/my_asm.s Sun Nov 06 22:36:01 2016 +0000 @@ -13,7 +13,7 @@ ; Load GPIO Port 1 base address in register R1 LDR R1, =0x2009c000 ; 0x2009C020 = GPIO port 1 base address ; Move bit mask in register R2 for bit 18 only - MOV.W R2, #(1<<4) ; 0x040000 = 1<<18 all "0"s with a "1" in bit 18 + MOV.W R2, #(1<<4) ; 0x040000 = 1<<18 all "0"s with a "1" in bit 18 (1<<4) ; value passed from C compiler code is in R0 - compare to a "0" CMP R0, #0 ; value == 0 ? ; (If-Then-Else) on next two instructions using equal cond from the zero flag