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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/29/04 13:14
Read: times


 
#82173 - C-asm delay
Responding to: ???'s previous message
There is no speed improvement possible on rewrititing soft I2C in asssembler, because you must still meet the I2C timing requirements (max 100 kbit).

"There is no speed improvement possible"
correct, however there is a "speed improvement through precision" possible.

1) Who can say what the delay is in a C delay routine without looking at tha assembler.
2) If you have to look at the assembler, why code in C
3) If the compiler changes the code when a newer release is used you may get failures from running too fast or start running slower.
4) Writing the code in assembler an exact cycle count can easily be obtained.

In other words "delay routines should never be written in anything but assembler", I recommend that such routines be conditioned by a defined OSC_FREQ that, if changed, would make the routine disappear, thus creating an error andf alerting the developer to change the routine.

FYI: the above is not assembler fanatism, just good practice.

Erik


List of 13 messages in thread
TopicAuthorDate
Interrupt Function Prototype & Keil            01/01/70 00:00      
   Re: Interrupt Function Prototype & Keil            01/01/70 00:00      
      No Parameters            01/01/70 00:00      
         ASM vs 'C'            01/01/70 00:00      
         Interrupt Routines            01/01/70 00:00      
            Assembly code no better than keil            01/01/70 00:00      
               efficient C            01/01/70 00:00      
         Hardware IIC            01/01/70 00:00      
         I2C(C) = I2C(asm)            01/01/70 00:00      
            C-asm delay            01/01/70 00:00      
               OSC_FREQ            01/01/70 00:00      
      no need for prototypes!            01/01/70 00:00      
         Same            01/01/70 00:00      

Back to Subject List