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

Assembly Program Error on Hardware

Hi,
I am trying out ARM Cortex M3 Assembly programming,and also succeeded in writing. All the codes i developed in assembly will get simulated but they don't work on Hardware(LPC1768). Kindly suggest me where i am Wrong.
The code is as follows.


;Experiment 1 : To calculate the sum of numbers from 10 to 1 and display the result on Port



;;; Directives
          PRESERVE8
          THUMB
                  UNIFIED
; Vector Table Mapped to Address 0 at Reset
; Linker requires __Vectors to be exported

          AREA    RESET, DATA, READONLY
          EXPORT  __Vectors

__Vectors
          DCD  0x20001000     ; stack pointer value when stack is empty
          DCD  Reset_Handler  ; reset vector
                  ALIGN

; The program
; Linker requires Reset_Handler

     AREA    MYCODE, CODE, READONLY
          ENTRY
          EXPORT Reset_Handler


Reset_Handler
;;;;;;;;;;User Code Starts from the next line;;;;;;;;;;;;



                 MOV R0,#00                     ; clear the register R0
                 MOV R1,#10                     ;mov the count value to register
loop     CMP R1,#00               ; check for condition  R1==0
                 BEQ    loopexit ; branch if count is zero
                 ADD R0,R1               ; add the number with previous result
                 SUB R1,#1              ; decrement the count
                 B loop                 ; loop back
loopexit
                MOV R2,R0               ; keep the result in R2


;Configuring Port 0 [P0.21-P0.28] to display the Result

                MOV R3,#0x1FE00000                ; Load the value 0x1FE to change the GPIO0
                                                   ; direction as output
                LDR R0,=0x2009C000              ; Load the Addres of FI0DIR Register
                STR R3,[R0]                      ; write value 0xFF to FI0DIR Register
                LDR R0,=0x2009C01C              ; Load the Addres of GPIOClr  Register
                STR R3,[R0]                     ;write value 0x1FE to to clear the GPIO pins
                LSL R2,#21;
                LDR R0,=0x2009C018         ; Load the Addres of GPIOSET  Register
                STR R2,[R0]                              ; Display the result on GPIO0


FINISH   B FINISH               ; keep looping infinitly
                END                     ; end of a program