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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/02/05 05:03
Modified:
  03/02/05 05:16

Read: times


 
#88839 - First of all....
Responding to: ???'s previous message
Rahul:
First of all stop trying to mix C and Assembly language. This is really just not a good idea. Do C or do assembler. If you must have assembler in a part of a program for performance then put those subroutines in a separate source file and link it to your C code files.

Next please realize that your method of trying to use the timer interrupt as a break switch to long sequences of C code is not going to work. Maybe just maybe an extremely seasoned programmer can find a way to get a kludge like that to work. But I can infer from your question about LJMPing out of a C timer ISR that you are not that seasoned programmer. Please also note that there are probably more than a few ways to re-visit your long code sequence and re-design it so that this "timer break" would not even be needed. In over 30 years of programming I have never seen an instance where it was not possible to restructure code to alleviate code problems like you find your self with.

Try to think outside the box about what you are really trying to acheive. You should consider the possibility to look at how to take the code that needs a quick response to the timer interrupt and place the minimal part of that job in the timer interrupt routine. Save the results of this time critical part of the job into a global variable or data structure. Finally have the ISR set a bit flag that reports to the main line loop that the timer condition has happened and that the results of that timer function are ready to be processed.

You could think of this job as similar to using a stop watch at a sporting event. Have your assistant (the timer ISR) focus on the single minded task of watching for the critical event to happen and push the stop button at the right moment. Meanwhile you (the mainline code) have been busily serving hotdogs at the sideline. After you get done with the current customer your assistant hands you the stop watch and you can take a leisurely moment to note the reading of the event time on the display which you can note into the log book as necessary. Opps, you have another hot dog customer.

Look at the assembler code in this link. There you will see a main loop that simply looks at a bit flag that gets set via the timer interrupt. In this example the timer interrupt is being used to make the main loop do its logic at a certain set pace.

Michael Karas


List of 53 messages in thread
TopicAuthorDate
problem with labels            01/01/70 00:00      
   First of all....            01/01/70 00:00      
   Jump to a specific point            01/01/70 00:00      
      Don't Do It!!            01/01/70 00:00      
         DO it!            01/01/70 00:00      
            No, don't!            01/01/70 00:00      
      Same label problem            01/01/70 00:00      
      Message Not Useful?            01/01/70 00:00      
         (-1 Message Not Useful)            01/01/70 00:00      
            Your wish...            01/01/70 00:00      
   break            01/01/70 00:00      
      this is for a printer            01/01/70 00:00      
         Bizarre!            01/01/70 00:00      
            Proportional font?            01/01/70 00:00      
               count columns            01/01/70 00:00      
                  columns?            01/01/70 00:00      
                     intelligent            01/01/70 00:00      
                  line printers            01/01/70 00:00      
                     hit me with a thud            01/01/70 00:00      
                        DP Lineprinters            01/01/70 00:00      
         breaking out of loops            01/01/70 00:00      
   the RETI barrier            01/01/70 00:00      
      The clever 8051 designers!            01/01/70 00:00      
         Clever            01/01/70 00:00      
         Bunch of bull.            01/01/70 00:00      
            RE:Bunch of bull.            01/01/70 00:00      
               Mehdi            01/01/70 00:00      
   Don't start from here            01/01/70 00:00      
   sdcc says unreachable code !            01/01/70 00:00      
      You get rid of it by....            01/01/70 00:00      
      Just don't do it!            01/01/70 00:00      
      Structure            01/01/70 00:00      
      global and local variables            01/01/70 00:00      
         Re:            01/01/70 00:00      
            Give It Up Rahul.            01/01/70 00:00      
            Man @ bottom of hole should stop digging            01/01/70 00:00      
               Man @ bottom of hole            01/01/70 00:00      
                  Stop digging!!            01/01/70 00:00      
                  OK, here it is!            01/01/70 00:00      
                     counting is getting difficult            01/01/70 00:00      
                        Counting should be easy!            01/01/70 00:00      
                           as a starter...            01/01/70 00:00      
                              solved !            01/01/70 00:00      
            Back to Basics            01/01/70 00:00      
      Blinker            01/01/70 00:00      
         need to jump..            01/01/70 00:00      
            Do NOT jump!            01/01/70 00:00      
            Timer            01/01/70 00:00      
   Lookup Table Character Generator            01/01/70 00:00      
      bit based lookup table            01/01/70 00:00      
         Try this:            01/01/70 00:00      
      Character building            01/01/70 00:00      
      Things are working good..            01/01/70 00:00      

Back to Subject List