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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/10/04 01:23
Read: times


 
#82868 - Dptr for code memory
Responding to: ???'s previous message


I'm not sure of what you're trying to achieve. Firstly, what is the problem with using cjne etc? If you can show us an example of code, we may be able to suggest an different method. As for a lookup table, what do you want to lookup?

For a simple lookup table:
;
; A has the idex into the lookup table
; returns looked up value in A
;
lookup:
mov dptr,#table
movc a,@a+dptr ;adds A to dptr, uses result as address, reads from code memory into A
ret

table:
db 1,2,4,8,16,32,64,128 ;value -> bit weight lookup


Or a jump table:
;
; A has routine# to jump to
;
;
jumpt:
mov a,b
rl a ;times 2
add a,b ;A = A times 3 (ljmp is 3 bytes long)
mov dptr,#jtable
jmp @a+dptr

jtable:
ljmp l0
ljmp l1
ljmp l2
ljmp l3

........






To implement timers, see:

http://www.8052.com/faq.phtml?FAQ=15

List of 14 messages in thread
TopicAuthorDate
DPTR for internal code            01/01/70 00:00      
   DPTR.......            01/01/70 00:00      
   Look at Instructions set            01/01/70 00:00      
   DPTR for code memory            01/01/70 00:00      
      Port scanning            01/01/70 00:00      
      DPTR and I/O Ports            01/01/70 00:00      
      Outputting and Inputting Bits            01/01/70 00:00      
         Jump Table?            01/01/70 00:00      
   It can Not            01/01/70 00:00      
   DPTR for code memory            01/01/70 00:00      
      Do the independent bit tests            01/01/70 00:00      
         very complex bit testing            01/01/70 00:00      
      Dptr for code memory            01/01/70 00:00      
   JB            01/01/70 00:00      

Back to Subject List