I am using a 89C450 mcu. I need to execute 1 of 100 subroutines depending on the value of the acc Sort of like a lookup table I think. Any ideas?
Lookup table?
Jan 20, 2008
3 Replies
Use JMP @A+ DPTR
Acc = jmp val DPTR = table start
entry:- MOV DPTR,#TABLESTART ADDA,A ADDA,A (A*3) JMP @ A+DPTR
Table start :
ljmp routine 0 (3 BYTES PER JUMP) ljmp routine1 . . . . ljmp routine99
Ooops not quite right......too late to think straight......
16 bit add to TableStart( DPTR), A 16 bit add to TableStart( DPTR), A 16 bit add to TableStart( DPTR), A (DPTR+0,3,6,9,etc)clr Acc jmp @A+DPTR
TableStart : Ljmp Routine0 (3 bytes) Ljmp Routine1 etc
Thanks very much Works like a charm
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required