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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/21/07 08:44
Read: times


 
#137693 - Simple,but no simpler
Responding to: ???'s previous message

Mike, you're trying to make your code more simple? By whose standards? If you make your code too simple - it may not perform the duty required. Also remember smaller code is not necessarily faster code. Don't forget hat most of us here understand what you're trying to do better than you do - don't try to argue and bring up half facts.

Using a register bank for your interrupts can save many cycles - that's why Intel included the feature - one instruction does a context change - how many other microcontrollers have this feature? Sure, you pay by using 8 bytes of iram, but you save on stack. Chose your poison.

As for moving the iram buffer to xram when the iram buffer gets full - just think about the extra logic to cope with this - and the cycles involved to copy it. You already feel tight on cycles and think your code is too big - why would you want to complicate it?


Firstly, understand how a processor works - specifically the 8051. You need registers, you need to use the stack pointer and you need some ram for the stack, unless you want to write highly cryptic code like on the older PICs. If you start using nasty tricks now, it will cause you problems later on. If you write your code in an obvious and consistant way, it will make your job easier. I started writing machine code when I was 12 - no help, no internet, no PC, so I dare say I've made all the mistakes one can make in programming. Ignore trying to 'crunch' your code - write code that works, once it all works then go back and with the benefit of some experience you'll see opportunities for optimisation or simply better ways to solve a given problem.
You tell us you like to learn - let yourself learn. You consistantly find the worst ways to do things and ask us to make it work for you, you also argue with us. For once, ask a question, take in the responses and leave it at that. Sometimes I think you're trying to do a 'Borat' on us with not much 'Great Success'


List of 17 messages in thread
TopicAuthorDate
if I could crunch my code...            01/01/70 00:00      
   Optimisation            01/01/70 00:00      
      the original 8051 is the problem...            01/01/70 00:00      
         Duhh!            01/01/70 00:00      
            again, I want to "crunch my code"            01/01/70 00:00      
               starg with something that works.            01/01/70 00:00      
               Did You Look at Movx @R0 ?            01/01/70 00:00      
                  Thanks (after I tried it LOL)            01/01/70 00:00      
                     data sheet            01/01/70 00:00      
                     Hidden P2 Register?            01/01/70 00:00      
               Simple,but no simpler            01/01/70 00:00      
         Problem?            01/01/70 00:00      
   save a few bytes by using JBC            01/01/70 00:00      
   an alternative            01/01/70 00:00      
   WRONG            01/01/70 00:00      

Back to Subject List