Monday, July 8, 2013

An Interrupt based DCC Decoder

In the early days of DIY DCC decoders, the preferred method of DCC decoding logic was to write precisely metered sections of hand-written assembly code that sampled the DCC input. These were based on the venerable 16C84 running at 4MHz.

But with modern PICs running at 32 MHz and over, it is possible to write an interrupt driven DCC decoder. This means no more intricately hand-coded assembly. You could write it in C without worrying too much about the code generated - within reason. So what is a good interrupt period to sample the DCC input? OK, 22us. But how accurate does this period have to be? Can we use the internal oscillator in a PIC? Yes, we can!

Saturday, July 6, 2013

A Small N Scale Layout

My previous layout was simple dog-bone that was 2800x460mm to fit on top of a wall unit. This time around I had much less space – 1200x600mm. The old one was well above eye level and most of the layout was out of sight. This time it is just 60mm off the floor and the whole layout can be sighted.

It is not based on any prototype. Truth be told, it is a test bed for my DCC project so all I wanted is enough complexity in this small space. In order to provide this complexity, I have pushed the specs up to and, possibly, beyond the edges of sanity. Future operations will tell if this was a wise decision.