Theory of operation

(You don't need to know this stuff; you can safely skip back to the next bit if you like.)

Power comes in to the bridge rectifier. The bridge rectifier turns AC into DC, or takes DC and turns it the right way round, so you don't have to worry about whether your plug pack is positive tip or negative tip or anything. We then whack the power across a big honkin' elecrolytic capacitor, to smooth out any bumps in the incoming power, and then push it into the 7805 voltage regulator. The 7805 is a magic beastie that takes a wide range of input voltages and puts out nice smooth 5V. We then whack another (smaller) capacitor across the output of this, to smooth it out even more, and then into the power pins of the two chips. PIC chips have a fairly strong dislike of noisy power, so all this smoothing is a Good Thing.

The PIC is a tiny little computer. The 10MHz crystal is used to give it a fast, precise clock, which is pretty essential in a fencing control box. The software on board the PIC sends pulses out the various lines that lead to the fencers, and listens for pulses coming back. It follows the various twisty-turny rules laid down by the FIE's electrical committee, and buzzes and turns on LEDs as appropriate.

The push-button in the middle of the board is used to select weapon, and has a small capacitor across it -- this is to act as a "de-bounce". When you push the button, you don't get a clean connect; you actually get a bunch of very brief connections as the switch settles into place. (Think of dropping a ball, and watching it bounce a few times before it settles onto the ground. Only much, much faster.) So the capacitor soaks up these bounces, meaning that the PIC sees a nice smooth transition.

You can see that we're pretty short of I/O lines on the PIC -- we're using nearly all of them. If you look closely at the way we drive the two LEDs for mode indication, you can see that we're driving both from one line. Logic high turns on one, logic low turns on the other. Of course, this means that we can't turn on both at once. Except that we sort of can -- we just flicker between the two really fast, so that to the human eye it looks like they're both on.

Note that the pin that fencing equipment normally regards as ground in fact isn't. This doesn't affect the operation of the box in any way.