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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/01/10 07:14
Modified:
  04/01/10 07:15

Read: times


 
#174713 - Good question..
Responding to: ???'s previous message
Andy Neil said:
Valentin Angelovski said:
MOV  DPTR, #1000h
CLR  A
MOVC A,    @A+DPTR

What's the point of the CLR A ?


Hi Andy,

A good question! Reason we zero the accumulator, is to remove the 'pointer offset' that is introduced into the subsequent MOVC instruction..

Say, for example the 'CLR A' opcode directive was removed from the above example and acc initially contained 32hex.. Upon execution of the MOVC instruction, data would be fetched from 1032h, instead of 1000h as originally intended!

Cheers, Valentin

List of 14 messages in thread
TopicAuthorDate
8051 Instruction MOV A, addr            01/01/70 00:00      
   If reading from codespace, use 'MOVC'            01/01/70 00:00      
      Why CLR A ?            01/01/70 00:00      
         Good question..            01/01/70 00:00      
            I must be going blind!            01/01/70 00:00      
               re            01/01/70 00:00      
                  Did you check the so-called "bible"?            01/01/70 00:00      
                     I should have clarified            01/01/70 00:00      
                        external            01/01/70 00:00      
                  reply to re            01/01/70 00:00      
      CLR A??            01/01/70 00:00      
         "bible" time            01/01/70 00:00      
            Done :-)            01/01/70 00:00      
   "bible" time            01/01/70 00:00      

Back to Subject List