I just feel much more comfortable having 6 files of around 50-100 lines each, each file having a specific task to complete, rather then having one monolithic 400-500 line file. Maybe I just have to break out of the PC programming (C) mentality, where you try and hide code away somewhere else (inside a module) once it is finished and debugged - this is perhaps one of the reasons for the "PBP /= Professional quality" attitude that many have: on a PC one always strives for modular, portable code 100% of the time. On a PIC, by the very nature of the beast that isn't always possible.
Do you guys follow PC convention in so far as removing 'magic numbers' from your code and using constants to control registers? By this I mean saying something like:
SLEEP_PORTE CON %00000101
WAKE_PORTE CON %00000010
~
Sleep:
PORTE = SLEEP_PORTE
Sleep
PORTE = WAKE_PORTE
Return
This gives you a convenient place up the top where you can define the PORT states for each 'program state'. Just to give an idea of where I'm coming from.... maybe I need to completely reset my perspective on this whole issue. (Could someone please pull the MCLR attached to my mentality to ground?)
Bookmarks