Electronic Design and Family Site
PIC Programming for "Experiments in DDS"

**(15 Mar 15) Thanks to an observant fellow hobbyist, a few mistakes were discovered and repaired on this program. As of today, it is verified functional on my hardware.

I taught myself to program PICs about 10 years ago. It was so I could use a AD8307 Log Amp to make a RF Power meter. I needed the PIC to perform the Log-to-Linear conversion for metering. While I was programming though, I pressed it into service making a BCD output for a LED display I had.

Being self-taught, I have had to learn many lessons the hard way. Since I don't program often, I find myself re-learning those lessons repeatedly. Now, I want to document those lessons here for my use, and to hopefully share what I've learned with those who are new to programming and need some basics. Below is my list of "Lessons Learned" in no particular order:

1.  Stick with one (or very few) controllers. All controllers have their own particular quirks. It takes time to learn the ins and outs of each device. Using a different controller each time you attempt a new project will involve heavy learning before you even start programming, and probably involve heavy debugging time as well.

2.  Add your config words into the program. MPLab allows you to program Config from within MPLab. This makes that programming quick and easy, but NOT repeatable later. If you don't write down the config you used, you may not be able to remember it next time; better to have it embedded in your code so it's the same every time the program runs.

3.  Save every minor change as its own version. It's so easy to change a single letter in the program and forget about it when you are making several changes. The change of a single letter however, can make the program stop operating, or operate very unexpectedly. Hard drive space is cheap, save EVERY change as a new version.

4.  Make a port map and be sure you know every function each port is capable of before you start programming. Once each port (and pin) is chosen, stick to it. It will be hard to find every place a particular port or pin is used later.