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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/18/07 06:34
Read: times


 
#140923 - How to branch through table, without CJNE ?
Hello all memebers, its me Asif Ali, (a noob again :-)

well this time i am having an another problem, but this time my problem is not that much big, cuz i have searched alot on net, and i think that there is only one thing i am missing, (which is always my criteria of problem :-)

My problem is that how to access the Instructions presented in table, (sounds weared ?)

let me explain,

i am programming my 89C51, and i have situation that i am getting a charecter from Serial, and after getting the Charercter, i have subtracted #030h from it so it become a lame Numeric, and i have used that numeric data for branching, but the problem is that i dont wanna use CJNE, cuz it will increase my program (and i am also lacking my 4K flash :-( ) so could any body tell me how to branch throught the table, ?

well i know that a SJMP instruction is 2 byte instruction so i will be multiplient the numeric with #002, hoping not very funny


Example Program,

                      ORG 0000H
                      LJMP MAIN
                      ORG 0030H
MAIN:                 LCALL SERIAL_INIT         ;serial Init without interrupt
AGAIN:                JNB RI,$
                      MOV A,SBUF
                      CLR RI
                      MOV B,#002H
                      MUL AB                    ;multiplieng to get the exact location
                      MOV DPTR,#MY_TABLE        ;moving the DPTR to my table value
                      MOVC A,@A+DPTR            ;now the A holds the data of exact location but the prob is how to branch there :-(
                      SJMP AGAIN

MY_TABLE:             SJMP LOC1                 ;My table here
                      SJMP LOC2
                      SJMP LOC3
                      SJMP LOC4
                      SJMP LOC5
                      




List of 11 messages in thread
TopicAuthorDate
How to branch through table, without CJNE ?            01/01/70 00:00      
   You are very close            01/01/70 00:00      
      Oh Thanks sir, :-) you are really great,            01/01/70 00:00      
      WoW sir it really worked:-) here is full code,            01/01/70 00:00      
         Not quite            01/01/70 00:00      
            re: Abbreviations            01/01/70 00:00      
         Some remarks            01/01/70 00:00      
            Some Corrected Remarks :-)            01/01/70 00:00      
               The difference            01/01/70 00:00      
                  other type of table, XOR instead CJNE ;-)            01/01/70 00:00      
               Rotate            01/01/70 00:00      

Back to Subject List