Saturday, November 24, 2012


Years ago, back in the late 90's, I built a CW decoder designed by Franceso Morgantini, IK3OIL.  It may be that this project actually got me interested in developing on  microcontrollers.  Not being able to let well enough alone, I made a  number of improvements (IMO) to Francesco's work.  And I reported it on my amateur radio web page.

I have always been a proponent of revision control systems.  Over the years I have found I often want to ressurect old code for some reason, and having an RCS not only made it easier to find old stuff, but also to understand what it had been through, something especially helpful if you intend to hack it up.

Back in the late 80's, it was PVCS on DOS and later Windows.  PVCS, it turns out, was a proprietary port of the ancient RCS to DOS.  Eventually the repository format changed to something more proprietary, and I began developing on more platforms, so I ended up moving most of my old PVCS repositories to RCS.

RCS stayed with me for years and years, through DOS, Windows, OS/2, Linux.  VMS had it's own system, CMS, which was actually pretty good so while I believe I ran RCS on VMS a little, it was never bread and butter on  that platform.  RCS had many, "better" descendants, CVS, SVN, etc., but RCS stuck with me since it did the job and  was available on every platform known to man, much like my beloved Emacs.

Somewhere around 2004 I realized that my PIC code really needed to be in a repo, so I reconstructed as best I could the history of my major PIC projects into RCS.

The PIC development platform, MPLAB, underwent many changes over the years, but the change from MPLAB 5 to MPLAB 6 was pretty major, and I wasn't able to reconstruct the links between those lines of development, so I made separate repos for MPLAB 5 development and MPLAB 6, 7 and 8 development which I prefixed with MPLAB_5 and MPLAB_7.

A few years ago I discovered git.  git has a few regressions from RCS, but it is so much easier to use that the incentive is to use it more.  So all my repos got converted to git.

Unfortunately, at the time, I hadn't yet learned the beauty of branches.  Recall that on RCS and it's descendants, branches are a major pain, so it took me some time to warm up to them.

But when I converted my repos to git, the independent repos from RCS got converted to independent repos on git.  With the MPLAB 5 vs. 7 stuff, it would have made much more sense to have branches, but I didn't know that at the time.

Circling back to the CW reader, from time to time I get a request for that code, especially since Francesco's original code has apparently disappeared from the web.  I recently got a request from a ham in Scotland, and when I grabbed the code for him, I realized I had been sending out the old MPLAB 5 code, which probably made life difficult for folks wanting to use it.

So, I duplicated the MPLAB 5 repo, and made a branch for the MPLAB 7 stuff, *AND* put it all in github, along with a rather elaborate README, so that folks could grab the code from there and if they needed some earlier variant they could see the genesis of the thing.

All this came just as I was struggling with getting a dsPIC30F4013 to talk to an MCP23008, and had just had the aha moment that even though this is a hack and of no permanent value, it still makes sense to put it in a repo and commit like a man posessed, so when the change to make B work causes A to quit, I can easily go back and see where I shot myself in the foot.

git is great!

Which brings me back to Elmer 166.  It is clear to me that anyone who thinks he can do serious development without git is either brain dead or a masochist. So it looks like something I should cover.  On the other hand, it is kind of off topic.  And the folks likely to take the course are probably somewhat unlikely to warm up to it, unless I can present it in a really appealing way.

So, more decisions.

Thursday, November 8, 2012

Decisions, Decisions

Although I view the choice of build/buy as somewhat open, we have been proceeding on the assumption that we would build a dsPIC-EL, and that it would involve some sort of 40-pin dsPIC30F.

We initially chose the dsPIC30F4011for a number of reasons:
  • It had the largest memory available in a DIP package
  • It had a complete set of peripherals, especially including a large number of output compare ports which can be used for a flexible PWM
  • It had a fast A/D

 But as we continue to look into the experiments we would like to run, we see an issue - the I2C and SPI pins are shared with the programmer.

This means that we either cannot use the debugger with I2C, or we need to provide some sort of jumpering mechanism or an additional programming connector in order to do in-circuit debugging.  Even if we provide the extra hardware, its use would be clumsy at best.

It would be good to have a lesson on I2C in the first place, and even better, the addition of some sort of I2C DAC might make for some interesting digital filtering experiments.  SPI is used for SD cards, so that also holds some promise for logging experiments.

The dsPIC30F4013 does not have this problem.

However, it has a slower (although higher resolution) A/D.   For the kinds of use we envision, the higher resolution isn't much of an advantage, and it takes very careful hardware design to effectively use all the resolution, so that A/D isn't much of an advantage.  Using the higher speed of the 4011's A/D does take a little care in the software, but it really isn't so burdensome.

The 4013 has the same memory as the 4011, and other than the A/D, a very similar set of peripherals.   One annoying feature; on the DIP dsPICs, there are no ports with all the pins implemented, and in the case of the 4013, PORTB is the only one with at least 8 contiguous bits.  Of course, the programming pins have to be on PORTB making it difficult to use all 8 bits.

However, there are no plans to actually need 8 bits of a port, even though it seems as if that is something almost necessary.  It would be nice to use an 8-bit interface for the LCD, thus simplifying the LCD code, but there is really no advantage besides a few lines of code. 

So, still more stuff to think about.