As I was looking through my Planet Minecraft profile, I took another look at my Day/Night Timer (check it out if you haven't) (shameless advertisement), and realized that I could use the same technology for a binary counter. The version that I have uploaded is a six-digit one, but this device can be infinitely expanded. The piston outputs are just placeholders, as the output is intended to be hooked up to a binary decoder. The line of red wool is the reset, and if the lever is activated on the AND-gate, the line will also prime the decoder, so that it is at 0 instead of off. However, if you want to turn the counter off, deactivate the lever and press the reset button. The counter will turn on if you press the input button. The input button is also a placeholder, so the input can come from anything, as long as the signal is sent into the input block with a repeater. Repeaters are on the output line to ensure that the pistons update at the same time, in order to prevent timing problems, such as those that occur when the machine is expanded.