PIC TRICKS (Harry Purves - July 01) In response to my request in Readout May ’01 for short snippets of interesting PIC codes, Harry Purves of Newcastle-upon-Tyne sent a lengthy E-mail about some definition tricks he finds useful. It is too long to quote in full but the summary is that he defines the Status flags and the actions to be taken following certain function tests (which can otherwise get him confused!). Examples are: #define carry status,0 #define dcarry status,1 #define zero status,2 #define ifzero btfsc zero #define ifnotzero btfss zero #define ifequal btfsc zero #define ifnotequal btfss zero #define ifcarry btfsc carry #define ifnotcarry btfss carry #define ifnegative btfss carry #define ifpositive btfsc carry As an example of the use of the latter he quotes: subwf count,w ifpositive goto positive_result return which causes a jump to the stated destination if indeed the result is positive. He keeps the definitions in header files so that they are always available for each project by simply "including" them at the start of the source file. For example: include "C:\Picprog\Projects\header\l6f84.h"