View previous topic :: View next topic |
Author |
Message |
Geps
Joined: 05 Jul 2010 Posts: 129
|
Working With Multiple PIC Systems |
Posted: Mon Oct 18, 2010 4:57 am |
|
|
Good morning,
Does anyone here have any tips writing code for systems with multiple PICs in CCS?
Is it better to use #INDEF and then set the #DEFINE for each system as you compile/program it or does it make things too complicated? Would I be better having different projects for each PIC?
Cheers, |
|
|
andrewg
Joined: 17 Aug 2005 Posts: 316 Location: Perth, Western Australia
|
|
Posted: Mon Oct 18, 2010 7:48 am |
|
|
For me, it's one project per application/component.
One of my recent systems went through three revisions. Different board and PIC for each as the final system specifications were narrowed down. I just set up conditional compilation, eg "#ifdef REVx" and used that to define the correct pin (and other) constants and bring in the correct device header. getenv() can be very handy. The vast bulk of the code was generic and shared among all revisions. Hence, just the one project.
For another system made up of several components, each component is its own project. _________________ Andrew |
|
|
sturnfie
Joined: 26 Apr 2010 Posts: 17 Location: Palatine, IL
|
|
Posted: Mon Oct 18, 2010 10:22 am |
|
|
I prefer to go with one application/component, but that's mostly because I don't mind the overhead of the extra project files. When working on a multiple PIC project set, there is usually only one file different in each project. In this file I place the unique application code for that PIC.
All shared code is placed in external shared libraries (the intercommunication code, most importantly) and pulled in via in-line #includes (_NOT_ local copies found in each project folder).
I find value in this approach as it separates the revision history of each portion of the larger project into individual branches (per component and per shared-library). Also, for multi-developer projects, it by-passes the merge conflicts that occur when multiple people are concurrently modifying a single, multiple application, file. _________________ Lucas Sturnfield
Blog - http://www.sturntech.com/blog |
|
|
|