3 Replies - 235 Views - Last Post: 11 November 2018 - 08:30 AM

#1 Caioww99   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-November 18

Help IAR 8051

Posted 02 November 2018 - 05:06 PM

Hello guys,

I am doing a study exercise, which has to determine the highest value among the elements of a memory range and store that value in the memory position following the last element of that range.

The memory range will be 5.
Memory position: 20h
Starting Position: 21h

The values ​​are random.

MOV R0, # 21h;
MOV R1, # 05h;
Mov 9pm, # 15h;
Mov 22h, # 09h;
mov 23h, # 12h;
mov 24h, # 07h;
mov 25h, # 00h;

Can someone help me please.

Is This A Good Question/Topic? 0
  • +

Replies To: Help IAR 8051

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14867
  • View blog
  • Posts: 59,319
  • Joined: 12-June 08

Re: Help IAR 8051

Posted 02 November 2018 - 05:07 PM

What is your question?
Was This Post Helpful? 0
  • +
  • -

#3 Caioww99   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-November 18

Re: Help IAR 8051

Posted 02 November 2018 - 05:26 PM

View Postmodi123_1, on 02 November 2018 - 05:07 PM, said:

What is your question?


I try this:
  Org 0000h
      MOV R0, #21h
      MOV R1, #05h
      Mov 26h,#00h
      MOV 21h,#15h
      MOV 22h,#20h	
      MOV 23h,#40h
      MOV 24h,#07h
BACK: MOV A,@R0
      CJNE A,26h,LOOP
LOOP: JC LOOP1
      MOV 26h,A
      INC R0
      DJNZ R1,BACK
LOOP1:INC R0
      DJNZ R1,BACK
      END
:code:


But the program never ends, why?

This post has been edited by modi123_1: 02 November 2018 - 05:47 PM
Reason for edit:: In the future please use the [code] tag button in the editor

Was This Post Helpful? 0
  • +
  • -

#4 turboscrew   User is offline

  • D.I.C Lover
  • member icon

Reputation: 171
  • View blog
  • Posts: 1,107
  • Joined: 03-April 12

Re: Help IAR 8051

Posted 11 November 2018 - 08:30 AM

You seem to be missing the 5th number.

I'm not sure what you run your program on, but there should be some kind of stop at the end.
Maybe it's RET, maybe breakpoint, maybe eternal loop.
The END is not supposed to generate any "end of program"-code. It's just supposed to tell the assembler to stop assembling.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1