Question: Assembly code for blink the LEDs from right to left then back again from the right side.Describe this assembly code step by step. AREA |.text|,

Assembly code for blink the LEDs from right to left then back again from the right side.Describe this assembly code step by step.

AREA |.text|, CODE, READONLY

EXPORT __main

ENTRY

__main

LDR R2, =0x2009C054 ;LPC_GPIO2->FIOPIN address, see LPC1768 manual

LDR R0, =0x2009C040 ;LPC_GPIO2->FIODIR address, see LPC1768 manual

MOV R1, #0xFF

STR R1, [R0] ;Set direction of all 8 pins to OUT

MOV R5, #1

B main_loop

delay

MOV R4, #0 ; int R4;

delay_loop

ADD R4, R4, #1 ; for(R4 = 0; R4 < R1; R4++);

CMP R4, R1

BLT delay_loop

MOV PC, LR ;return

main_loop

CMP R5, #0x100

MOVEQ R5, #1

MOV R3, #1

STR R5, [R2] ;turn on LED - write 1 to FIOPIN

LDR R1, =6000000

BL delay ;delay(12000000)

MOV R3, #0

STR R5, [R2] ;turn off LED - write 0 to FIOPIN

BL delay

LSL R5, R5, #1

B main_loop

ALIGN

END

Can someone explain in detail the following assembly language program? The program is written using KEIL.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!