reading a 16 byte array with the 8051

Status
Not open for further replies.

Octavius12

Newbie level 2
Joined
May 3, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,294
Hello, first time post there. Im just having a little trouble writing a sub routine to be used on my 8051

All I need to do is scan an array of 16 consecutive numbers from external memory starting at a location (lets say 2020h) and returns the high byte of the maximum unsigned value on R2 and the low byte on R3.

i started with

mov DPTR, #2020h
mov R0, #10h


but now I'm pretty stuck. Im new to this


Any help would be much appreciated
 

to take the date from external ram memory, u can use the following instruction,
movx a,@dptr
mov r2,a

above instructions fetches data from external memory and puts it into the r2 register. similarly u can do it for other data.
thank u.
 

If i did

Mov DPTR,#2020h
MOV R0, #10
MOVX A,@DPH
MOV R2, A
MOVx A,@DPL
Mov R3, A

would this do what I have described? As in scanning the array of 16 consecutive numbers from external memory starting at a location (lets say 2020h) and returns the high byte of the maximum unsigned value on R2 and the low byte on R3?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…