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

Back to Subject List

Thread Closed: Issue successfully resolved

???
03/12/04 03:00
Read: times


 
#66553 - RE: I need help
Responding to: ???'s previous message
Thank Michael,

Now I can lookup the table in C.
But in ASM I still get trouble with the limitation of ( 0-255 ) range.

TABLE3:
DB 055H, 034H, 0AAH, 032H, 099H
DB 021H, 032H, 075H, 054H, 0A3H

; ......... initilize all the entries

DB 000H, 000H, 000H, 000H, 000H

; SUBROUTINE TO LOOKUP ONE ELEMENT OF TABLE3 OF BYTE
; VALUES AND RETURN THE BYTE VALUE IN THE A REGISTER
; THIS HAS THE INDEX OF THE ARRAY IN R6::R7

LOOKUP3:
MOV A,#LOW (TABLE3) ; get address of table3 + R6::R7
ADD A,R7 ; into DPTR
MOV DPL,A
MOV A,#HIGH (TABLE3)
ADDC A,R6
MOV DPH,A
CLR A
MOVC A,@A+DPTR ; fetch table element to A reg
RET

Your code only pick the first element from table.
When I try to use
loop :
MOV c,#0000H
MOV A,c
...
inc c
==> this cause an error (because c is direct address)

Is there any way to take all elements???
Now I am using 89C51. It has 4K ROM, if I put a 3.5K table in it. Is there any problem happen??

Thanks




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