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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/04/06 12:56
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#115568 - a sketch
Responding to: ???'s previous message
mov dptr, #COMMAND1

If I could I would send COMMAND1 to the unit and it would format and send COMMAND1. If I sent it COMMAND2 it would format and send COMMAND2. Of course, I can't use a label in that way, but is there an alternative?


mov dptr, #COMMAND1

can be replaced by:

;; ac must contain command number *2
  mov  dptr,#CmdTable
  push acc
  movc a,@a+dptr
  mov  r0,a
  pop  acc
  inc  a
  movc a,@a+dptr
  mov  dph,a ;assuming endianness of your assembler
  mov  dpl,r0

CmdTable: dw COMMAND0,COMMAND1,COMMSND2
some of the above may be assembler dependent, do nmot consider it 'code' consider it 'method'

Erik

List of 7 messages in thread
TopicAuthorDate
Labels as parameters?            01/01/70 00:00      
   a sketch            01/01/70 00:00      
      Thanks            01/01/70 00:00      
         Superb.            01/01/70 00:00      
            amazingly enough            01/01/70 00:00      
      my last use of this sketched            01/01/70 00:00      
         Aha!            01/01/70 00:00      

Back to Subject List