Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Thread Closed: Issue successfully resolved

???
03/13/04 11:09
Read: times


 
#66639 - RE: I need help
Responding to: ???'s previous message
Nguyen Duc Toan wrote:
-------------------------------

Well patrick

I wrote this code with Michael's suggestion. I think he's right. And I can't any problem with the 'logic'.

org 0
jmp main
org 30h
main :
...
I put the table just behind subroutine LookUp.
I had simulated this code many time any all results are the same : DPTR=03EB

I think movc A,@A+DPTR will pull data from the address that pointed by DPTR's content.



ACCESS_INDEX equ 864
ACCESS_COUNT equ 864

main:

MOV R6, #HIGH(ACCESS_INDEX) ;R6=03 (hex)
MOV R7, #LOW(ACCESS_INDEX) ;R7=60 (hex)
;
; Subruotine
LOOKUP3:
mov a, #low(table) ; A=8B (hex)
add a, r7 ; A=EB (hex)
mov dpl, a ; DPTR=00EB
mov a, #high(table) ; A=03 
you load A with 03H
addc a, r6 ; A=03
You add contents of R6 (loaded 03H) to A
mov dph, a ; DPTR=03EB
I think 06EBH is in DPTR
clr a ; A=00
movc A, @A+DPTR ; A=00 (hex)??? A(should)= 4B
RET
table:
DB #04Bh 




I can be wrong, but I think yor DPTR does not contain 03EB

regards
Patrick


List of 36 messages in thread
TopicAuthorDate
C Programe for 8051            01/01/70 00:00      
   Reading List            01/01/70 00:00      
      RE: Reading List            01/01/70 00:00      
   RE: C Programe for 8051            01/01/70 00:00      
   Sorry for the new thread            01/01/70 00:00      
   I need help            01/01/70 00:00      
      Learning 'C'            01/01/70 00:00      
      RE: I need help            01/01/70 00:00      
         RE: I need help            01/01/70 00:00      
            RE: I need help            01/01/70 00:00      
               RE: C table lookup            01/01/70 00:00      
            RE: I need help            01/01/70 00:00      
               RE: I need help            01/01/70 00:00      
                  RE: I need help            01/01/70 00:00      
      RE: I need help            01/01/70 00:00      
         RE: I need help            01/01/70 00:00      
         RE: I need help            01/01/70 00:00      
            RE: I need help            01/01/70 00:00      
               RE: I need help            01/01/70 00:00      
                  RE: I need help            01/01/70 00:00      
                     RE: I need help            01/01/70 00:00      
                        RE: I need help            01/01/70 00:00      
                           RE: I need help            01/01/70 00:00      
                              RE: I need help            01/01/70 00:00      
                                 RE: I need help            01/01/70 00:00      
                                    RE: I need help            01/01/70 00:00      
                                 RE: I need help            01/01/70 00:00      
         RE: I need help            01/01/70 00:00      
            RE: I need help            01/01/70 00:00      
               RE: I need help            01/01/70 00:00      
                  RE: I need help            01/01/70 00:00      
            RE: I need help            01/01/70 00:00      
               RE: I need help            01/01/70 00:00      
                  RE: I need help            01/01/70 00:00      
                     RE: I need help            01/01/70 00:00      
                  RE: I need help            01/01/70 00:00      

Back to Subject List