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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/24/08 04:42
Modified:
  04/24/08 04:43

Read: times


 
#153921 - Acall???
Responding to: ???'s previous message
I do not see any ACALL opcodes in your program at all.

Take a look at this code section:

        INC  R0
        AJMP LOOP0 

LOOP0:  CJNE R0,#34H,LOOP1 


In the case of this sequence there is no need for the AJMP LOOP0. If you took that and the LOOP0 label away there will be no net functional behavior of your program except for the extra entropy caused by spending time executing a jump to where you would have ended up anyway!!

Now lets consider this one:

        MOV @R0, A 
        LJMP FINISH 

FINISH: END


Here you have a similar type of jump that performs no good function. If you took it out the program flow would end up at the same place anyway.

This little gem also reveals another problem with your program. The MCU instruction set does not include an opcode called END which causes the processor to shutdown!! When your program gets to the FINISH: lable it will try reading instructions that happen to be at the next following addresses in the code memory? What is there? Some magical "catch my program counter" safety net? Nope...just either garbage in the code space or erased/unprogrammed memory. So you need to come up with a scheme to make sure your program remains in control of itself. One alternative may be to leave your LJMP FINISH in there and put it to some good use by moving the FINISH: label off the END statement and putting it instead on the LJMP line!!

Yet another thing to consider in this little program is for you to evaluate the need to load the #035H value into R0 after then end of the summation loop. Try to guess what value is already in RO after the loop is finished.

There is at least one more bug-a-boo in your program that will keep it from working as expected. I let you fix the things that Robert pointed out and that I've discussed here and then try to find the other functional problem with the code.

Michael Karas



List of 18 messages in thread
TopicAuthorDate
Registers and data movment.            01/01/70 00:00      
   ...replace this with your code...            01/01/70 00:00      
      IDEA            01/01/70 00:00      
         Any idea...            01/01/70 00:00      
            I bet if your instructor knew about this...            01/01/70 00:00      
               Too bad ...            01/01/70 00:00      
                  In the UK...            01/01/70 00:00      
                     if they told ...            01/01/70 00:00      
   my CODE            01/01/70 00:00      
      Here iis a hint:            01/01/70 00:00      
      how is that ever going to stop ?            01/01/70 00:00      
   i'VE GOT THE CODE!!!!            01/01/70 00:00      
      Please use the insert code button!            01/01/70 00:00      
         Is "well structured" code ...            01/01/70 00:00      
            comment            01/01/70 00:00      
               then, why don't you ?            01/01/70 00:00      
         Acall            01/01/70 00:00      
            Acall???            01/01/70 00:00      

Back to Subject List