This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Need help to review my First assembly code communicating to GPIO of LPC2148

I am not using any start up code, Please find the below only assembly code and make sure me that, is it the right way to communicate to my GPIO on LPC2148, or any changes required for this, Some of the code is repeated since I am new to ARM assembly coding, so will take some time to understand all available instructions and usage. Thanks in advance for the help

Assembly code:

AREA ToggleTest, CODE, READONLY ENTRY

mov r0,#0x00000000 ldr r1,=0xE002C000 str r0,[r1]

mov r0,#0xFFFFFFFF ldr r1,=0xE0028008 str r0,[r1]

repeate mov r0,#0xFFFFFFFF ldr r1,=0xE0028004 str r0,[r1]

delay mov r3,#0x02
reasign mov r2,#0xFFFFFFFF
dec sbc r2,r2,#01 cmp r2,#0 bne dec sbc r3,r3,#01 cmp r3,#0 bne reasign

mov r0,#0xFFFFFFFF ldr r1,=0xE002800C str r0,[r1]

delay1 mov r3,#0x02
reasgn1 mov r2,#0xFFFFFFFF
dec1 sbc r2,r2,#01 cmp r2,#0 bne dec1 sbc r3,r3,#01 cmp r3,#0 bne reasgn1

B repeate

END

  • Please review posting instruction with respect to placing source code in messages.

    http://www.keil.com/forum/tips.asp

  • Sorry, Thanks for the suggestion.

    I am not using any start up code, Please find the below only assembly code and make sure me that, is it the right way to communicate to my GPIO on LPC2148, or any changes required for this, Some of the code is repeated since I am new to ARM assembly coding, so will take some time to understand all available instructions and usage. Thanks in advance for the help

    All Instructions are in the form of BOLD and labels are in the form of italic

    Assembly code:

    AREA ToggleTest, CODE, READONLY ENTRY

    MOV r0,#0x00000000 LDR r1,=0xE002C000 STR r0,[r1]

    MOV r0,#0xFFFFFFFF LDR r1,=0xE0028008 STR r0,[r1]

    repeate MOV r0,#0xFFFFFFFF LDR r1,=0xE0028004 STR r0,[r1]

    delay MOV r3,#0x02
    reasign MOV r2,#0xFFFFFFFF
    dcrmt SBC r2,r2,#01 CMP r2,#0 BNE dcrmt SBC r3,r3,#01 CMP r3,#0 BNE reasign

    MOV r0,#0xFFFFFFFF LDR r1,=0xE002800C STR r0,[r1]

    delay1 MOV r3,#0x02
    reasgn1 MOV r2,#0xFFFFFFFF
    dcrmt1 SBC r2,r2,#01 CMP r2,#0 BNE dcrmt1 SBC r3,r3,#01 CMP r3,#0 BNE reasgn1

    B repeate

    END

  • I am not using any start up code, Please find the below only assembly code and make sure me that, is it the right way to communicate to my GPIO on LPC2148, or any changes required for this, Some of the code is repeated since I am new to ARM assembly coding, so will take some time to understand all available instructions and usage. Thanks in advance for the help

    All Instructions are in the form of BOLD and labels are in the form of italic

    Assembly code:

    AREA ToggleTest, CODE, READONLY

    ENTRY

    MOV r0,#0x00000000

    LDR r1,=0xE002C000

    STR r0,[r1]

    MOV r0,#0xFFFFFFFF

    LDR r1,=0xE0028008

    STR r0,[r1]

    repeate MOV r0,#0xFFFFFFFF

    LDR r1,=0xE0028004

    STR r0,[r1]

    delay MOV r3,#0x02
    reasign MOV r2,#0xFFFFFFFF
    dcrmt SBC r2,r2,#01

    CMP r2,#0

    BNE dcrmt

    SBC r3,r3,#01

    CMP r3,#0

    BNE reasign

    MOV r0,#0xFFFFFFFF

    LDR r1,=0xE002800C

    STR r0,[r1]

    delay1 MOV r3,#0x02
    reasgn1 MOV r2,#0xFFFFFFFF
    dcrmt1 SBC r2,r2,#01

    CMP r2,#0

    BNE dcrmt1

    SBC r3,r3,#01

    CMP r3,#0

    BNE reasgn1

    B repeate

    END