> > >> >>Good day, >> >>I need a suggestion. Suppose, one can implement the >>same thing by using a subroutine and by using a macro. Examples - a >>delay or a 'clear screen' command to LCD driver. What criteria should >>I use to decide which (subroutine or macro) to use for the >>implementation? >> >>Thanks in advance. >> >>Peace, >>Mohit Mahajan. >> As Al pointed out there are a lot of factors in this type of decision. Some other aspect you may need to take into consideration are: Rapid Application Development Debug-ability Power usage Device cost For instance, you can usually get a faster device and/or a device with more space, but then the device costs more and consumes more power. Macros and Subroutines both have issues with how you can debug the code - for instance you may go over your code a dozen times without taking into account how the macro affects the z bit, whereas a subroutine may be more transparent (it really depends on your frame of mind) To aid this, all macros and subroutines should have a header which: * Names the macro/subroutine * Brief description of its purpose * Inputs and range * Outputs and range * Any other bits/bytes changed or used (ie, W may be destroyed, Z, C, or status may be affected, etc) And refer to it when you have a problem you can't solve. Lastly is RAD, or Rapid Application Development. Some programmers prefer one method over the other, and some programmers have libraries of macros and subroutines both of which speed (significantly) the development process. Since you don't have time or money invested in one or the other then it may not affect your decision now, but if your macros and subs are useful, consider creating a seperate library for them and starting your own collection. Most of the decision should rest on the other facters, but you ought to consider this now before you realize a few years down the road that you've written (and debugged) this same 5 lines of code dozens of times and you should've put it into a library. -Adam -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics