Site hosted by Angelfire.com: Build your free website today!
Spider RooM Labs

Tutorial pages - PIC Programming tips

Page is under construction. When I'll remember anything worth mentioning I'll add it here.


- If you need a short delay (several NOPs), use GOTO $+1 instead of NOPs. It does the same as two NOPs, except you gain one program location. The drawback is that you have to be careful when using it in multipage code (code that exceeds 1 kword in lenght).

- When doing look-up tables you can use a DT instead of RETLW. DT allows you to put a few values in the same line (separated with commas)and also to declare strings
  Example: DT "Hello" equals to
           RETLW 'H'
           RETLW 'e'
           RETLW 'l'
           RETLW 'l'
           RETLW 'o'

- Check out the alternative mnemonics that are supported by MPASM. They can be very helpful.

- When dealing with longer code, split it into multiple files and then include them into main program. This should almost eliminate the scrolling through the code (e.g. when you are at line 1000 and you just can't remember what name you have given to a certain register at the top of the code). These files don't need to have .asm or .h extensions, name them logically like .dcl for variable declaration file or .mcr for the file with all the macros.
 
 
 


(C) 1999 Bojan Burkeljc
Last update: 4th November 2000