PIC pong clock

[Andrew] built this pong clock over the span of a couple of days. The PIC 18f2520 he used can serve as a real time clock with the addition of an external clock crystal. His project proves the usefulness of an oscilloscope as poor board layout caused interference in the crystal connections, something difficult to troubleshoot without this handy lab tool.

Pong clocks have been quite popular. This one is nice because it’s easy to throw together now that [Andrew’s] done the coding work for you. Written in assembly, reading and understanding his code might be a good exercise if your low-level language skills are lacking.

Until this week I’ve always programmed PICs in assembler, but I’ve started using C via the HI-TECH assembler in the 45-day pro-demo. It’s very intuitive – as in nice definitions in the header – and makes very small binaries. Free mode – without the omniscient code generation – is the opposite.

I particularly like the assembler embedding to do bitwise operations:
#asm
bcf 0x0b, 2
#end asm

rather than:
INTCON &= (1 << 2);

Although in this example the pro mode HI-TECH compiler spots what I'm trying to do and boils over 10 instructions down to just the 1.

It's a shame it's so expensive, I really would like an intuitive, efficient and free C compiler for PIC16 MCUs.