One of THE most brilliant things I've ever seen. #define _TRIS(pin) pin(_TRIS_F) #define _TRIS_F(alpha,bit) (TRIS ## alpha ## bit) #define _PORT(pin) pin(_PORT_F) #define _PORT_F(alpha,bit) (R ## alpha ## bit) #define _LAT(pin) pin(_LAT_F) #define _LAT_F(alpha,bit) (LAT ## alpha ## bit) #define _WPU(pin) pin(_WPU_F) #define _WPU_F(alpha,bit) (WPU ## alpha ## bit) #define pinSwitch(f) f(A,2) //Switch, INPUT , pin RA2 #define pinLed(f) f(B,5) //Led, OUTPUT , pin RB5 _TRIS(pinSwitch) =3D 1; //make pin an input _WPU(pinSwitch) =3D 1; // turn on internal pull-up _TRIS(pinLed) =3D 0; // make pin an output while(1){ =20 _PORT(pinLed) =3D ! _PORT(pinSwitch) } Why is it so brilliant? Because now, you can write a standard code library, without any pin assignment crap in it, and simply include a standard .h fil= e (pins.h for example) which you make for each project. In that file, you do the=20 #define pinSwitch(f) f(A,2) //Switch, INPUT , pin RA2 Etc.. ....thing and include it into the main project as well. If, at any point, an= d for each project, you need to change the pin assignments, you just change them one place, in that one project, and all the libraries are updated and working. And, as far as I can see, it's standard C preprocessor macros. Versions already exist for AVRs From: http://www.starlino.com/port_macro.html With extensions for HiTech at http://www.piclist.com/techref/language/ccpp/iomacros-starlino.htm -- James Newton 1-970-462-7764=20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .