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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/16/08 20:12
Read: times


 
#157515 - Ah the benefit of code re-use
Responding to: ???'s previous message
The situation that Raghu has described is one reason that I like to save the code from each type of SFR function in its own source file with attendant include or header file. Liberal comments in these show the initialization options available and those used. Then all the code to deal with this device is captured into this source file. I end up with a batch of source files like:

UART.ASM
UART.INC
I2C.ASM
I2C.INC
ADC.ASM
ADC.INC
SPI.ASM
SPI.INC
PIO.ASM
PIO.ASM

On a later project the process of pulling together the code setup for the new code set is simply gathering the necessary files together and reviewing the initialization options therein. In the beginning of MAIN.ASM there will be a whole sequence of code to routines such as:

CALL UART_INIT
CALL I2C_INIT
CALL ADC_INIT
CALL SPI_INIT
CALL PIO_INIT

Using this scheme it is often only necessary to return to the manual when utilizing a new SFR set that has not previously been deployed on a project.

Michael Karas


List of 17 messages in thread
TopicAuthorDate
Amnesia ( =loss of memory)            01/01/70 00:00      
   Only a problem when...            01/01/70 00:00      
   A matter of practice            01/01/70 00:00      
      Two replies...            01/01/70 00:00      
         All normal            01/01/70 00:00      
         Plus....            01/01/70 00:00      
   It only gets worse...            01/01/70 00:00      
   Ah the benefit of code re-use            01/01/70 00:00      
      A good idea..            01/01/70 00:00      
   memory and professional carrier            01/01/70 00:00      
      Documenting "why" and not so much "how"            01/01/70 00:00      
         this is not the point            01/01/70 00:00      
            Art of knowing what you will need in future..            01/01/70 00:00      
               After 20 years 8051 assembler,            01/01/70 00:00      
                  c'mon, don't be shy            01/01/70 00:00      
                  Learning typing            01/01/70 00:00      
                     Often fast but hard to multitask            01/01/70 00:00      

Back to Subject List