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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/14/05 22:31
Read: times


 
#99386 - Code optimization suggestion?
Do any of you out there know of a better way to run this code snippet in an app I've been playing with?


led_out:
mov R2,#0
mov R3,#2

CJNE r0,#d'0,asc10
ret
asc10: CJNE r0,#d'10,asc13
ret
asc13: CJNE r0,#d'13,asc32
ret

asc32: CJNE r0,#32,asc33
MOV DPTR,#ch32
ljmp ledloop
asc33: CJNE r0,#33,asc34
MOV DPTR,#ch33
ljmp ledloop

...
...
...

asc125: CJNE r0,#125,asc126
MOV DPTR,#ch125
ljmp ledloop
asc126: CJNE r0,#126,ledret
MOV DPTR,#ch126

ledloop:
lcall LED_CLR
mov A,R2
movc A,@A+DPTR
nop
mov P3,A
mov A,R3
mov P1,A
add A,R3
mov R3,A
inc R2
JNZ ledloop
ledret:
ret

I'm using this in a routine to display characters on a "5x7 Dot Matrix" display. I was just curious if there a way to back a simpler routine, than all those sequential commands. (i.e combination parameter like in basic you could say "goto ch$val" or something like that?)

"#ch???:" on the "MOV DPTR," instruction are the bit definitions on the characters i've defined for the "Dot Matrix" displays.






List of 14 messages in thread
TopicAuthorDate
Code optimization suggestion?            01/01/70 00:00      
   Table            01/01/70 00:00      
      Table?            01/01/70 00:00      
         Another table ...            01/01/70 00:00      
   CJNE            01/01/70 00:00      
      Everybody is saying to use a table            01/01/70 00:00      
         My confsion            01/01/70 00:00      
   two tables            01/01/70 00:00      
      Tables            01/01/70 00:00      
         sure            01/01/70 00:00      
            gurus don't subtract constants            01/01/70 00:00      
   16 bit table            01/01/70 00:00      
      bit table            01/01/70 00:00      
   Table indexing            01/01/70 00:00      

Back to Subject List