Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[ARM] Assembly program for lpc2147

Status
Not open for further replies.

hirenn

Full Member level 1
Full Member level 1
Joined
Jul 12, 2014
Messages
96
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
703
Hello !

anybody knows how can i write an assembly language program for ARM processor to find sum of
3P+4Q+9R, where P=2, Q=5 and R=4.

Thanks !
 


Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
clrf w
addlw 2
addlw 2
addlw 2
addlw 5
addlw 5
addlw 5
addlw 5
addlw 4
addlw 4
addlw 4
addlw 4
addlw 4
addlw 4
addlw 4
addlw 4
addlw 4



w contains d'56'

would work on a pic ,is that your home work ?
 
Last edited by a moderator:
  • Like
Reactions: hirenn

    hirenn

    Points: 2
    Helpful Answer Positive Rating
it's based on ARM lang, i cant understand that code,
can anybody give me basic tutorial link for arm7 32bit
thanks a lot
 

i dont understand that code, can you please explain
 


Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
11
mov r0, #2              ;move 2 to r0
mov r1, #3              ;move 3 to r1
mul r0, r0, r1          ;r0 = r0 * r1 (2 * 3)
mov r1, #5              ;move 5 to r1
mov r2, #4              ;move 4 to r2
mul r1, r1, r2          ;r1 = r1 * r2 (4 * 5)
add r0, r0, r1          ;r0 = r0 + r1 (3P + 4Q) = Z
mov r1, #4              ;move 4 to r1
mov r2, #9              ;move 9 to r2
mul r1, r1, r2          ;r1 = r1 * r2 (4 * 9)
add r0, r0, r1          ;r0 = r0 + r1 (Z + 9R)



- - - Updated - - -

Zip and post Keil uVision project (asm template) for LPC2147. I will add my code and debug and put the result here. I just studied a book on ARM assembly programming and made the above code. Finally r0 register will hold the result.
 
  • Like
Reactions: hirenn

    hirenn

    Points: 2
    Helpful Answer Positive Rating
Try this.


Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
GLOBAL  Reset_Handler
                AREA    RESET, CODE, READONLY
                
                ENTRY
                
Reset_Handler
                
                mov r0, #12
                
stop    
                mov r0, #2              ;move 2 to r0
                mov r1, #3              ;move 3 to r1
                mul r2, r0, r1          ;r0 = r0 * r1 (2 * 3)
                mov r1, #5              ;move 5 to r1
                mov r3, #4              ;move 4 to r2
                mul r0, r1, r3          ;r1 = r1 * r2 (4 * 5)
                add r1, r0, r2          ;r0 = r0 + r1 (3P + 4Q) = Z
                mov r3, #4              ;move 4 to r1
                mov r4, #9              ;move 9 to r2
                mul r5, r3, r4          ;r1 = r1 * r2 (4 * 9)
                add r0, r1, r5          ;r0 = r0 + r1 (Z + 9R)
                
                B       stop
 
                end




112143d1417983861-arm_asm.png
 

Attachments

  • arm_asm.png
    arm_asm.png
    159.2 KB · Views: 151
Last edited:
  • Like
Reactions: hirenn

    hirenn

    Points: 2
    Helpful Answer Positive Rating
what is AREA RESET, CODE, READONLY

and ENTRY

in code, why write it .
 

I don't know about ARM Programming. I just saw an eample of creating a LPC ARM project in Keil on youtube and created the project and read a few pages about ARM assembly language and wrote the code. If you want to understand all those things then read a good book about ARM programming and Keil MDK ARM manual.
 

**broken link removed**
 
  • Like
Reactions: hirenn

    hirenn

    Points: 2
    Helpful Answer Positive Rating
Hirenn have your ever written any code for lpc21247 ?
could you post your attempt to solve this problem ?
David
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top