Versão em Português

The Binary Clock in HMS Gray Code Mode

Instructions to read a binary clock in Hour-Minute-Second plus with Gray Code, along with a visual JavaScript simulation with hints.

JavaScript Simulation

17 41 23
Hints: LED Values

If your browser supports JavaScript and you have it enabled, the example above should be "live", showing the current time from your computer's clock and updated once a second just like the real-life binary clock, but with extra hints to help you understand the display. Click on the checkboxes to disable/reenable the various levels of hits as you gain experience.

If your browser does not support JavaScript or you don't have it enabled, the picture above will be static, sorry.

How to read the clock in this mode

This mode is similar to the HMS mode, where each pair of columns act as if they were stacked one above the other. However, each group is encoded in Binary-Reflected Gray Code.

A Gray Code is one of many ways to count in binary such that from one number to the other we change only one bit. There are several variations of Gray codes; the most famous is probably the Binary Reflected variety.

Notice that when going from 0 to 1, the LED "1" lights. The transition from 1 to 2 makes LED "3" turn on -- again, only one LED has changed. The same happens from 2 to 3: LED "1", which was previously on, goes off. The only case where more than one LED changes is the transition from 59 back to 0.

This is one of the most challenging modes to read: there are sixty possible bit patterns, a bit too much for most people to memorize; performing the arithmetic seems the best choice, even though some cases can require adding/subtracting up to six numbers.

Here's how to do it: in each group (hours, minutes or seconds), start from the largest-valued LED that is on. Subtract this from the value of the next lower-valued LED that is on. Then add the value from the next LED that is on. Then subtract, then add, then subtract, then add -- at each LED on you alternate adding and subtracting.

As with the standard HMS mode, the largest valued LED in each group will never light.

Kiko > EmbeddedSystems > BcdClock > TheBinaryClockInHMSGrayMode
Creative Commons License   The content of this site is made available under the terms of a Creative Commons License, except where otherwise noted.
  O conteúdo deste site está disponibilizado nos termos de uma Licença Creative Commons, exceto onde dito em contrário.