This is a simplified drawing of the microcontroller pinouts, showing the pins as they are configured for the two holiday electronics project. All of the lines shown, except power, ground, and reset, are configured as general purpose outputs, and are capable of sourcing plenty of current to drive LEDs.
For the menorah, the external configuration of the nine LEDs is particularly simple: The cathodes of the nine LEDs connect to pins 2-10, and the anodes to pins 11-19. Be aware that the LED in the middle acts like the “lighter” candle.
The alphanumeric LED display that we are using for the micro-readerboard ornament is the Kingbright PSA08-11HWA. You can find the detailed datasheet for the display here. I’ve excerpted the most important part, which is how the pins map to the segments of the display:
In our assembled ornament, the microcontroller sits on the back side of the LED display such that most of the ATtiny2313 output pins go to inputs of the LED display. The microcontroller has 20 pins while the display only has 18, so microcontroller pins 1 and 20 do not directly line up with any pins on the display.
Pin 2 of the ATtiny2313 goes to pin 18 of the display,
pin 11 of the ATtiny2313 goes to pin 9 of the display,
and pin 19 of the ATtiny2313 goes to pin 1 of the display.
For each letter that might be displayed on the ornament, we determined which segments should be lit up. Those segments to be lit are marked by a binary #1, and those to be dark are marked with a binary #0. The sixteen binary digits that determine the state of the sixteen segments comprise two bytes worth of data, the order of the bits in the two bytes is determined by the physical location of the pins on the microcontroller and the pins on the LED display. For example, segment ‘a’ of the display is controlled by pin 1 of the display. Pin 1 of the display touches pin 19 of the microcontroller, which is output B7. Following similar logic, the format of the two bytes is as follows:
|Byte High||Byte Low|
With this definition of the two data bytes, it was possible to construct the data table, with its 16-bit binary representation of each letter. The decimal value (unsigned integer) corresponding to the binary number is also given; these are the ‘practical’ values that were used in the C code.
Note that since the PSA08-11HWA is a common-anode device, its pins are actually driven by negative logic: a logical ‘0’ on a given pin of the display turns on one of the segments. The data table with its binary and decimal digits is entirely in “positive” logic (which is generally easier to work with), so a bitwise NOT is applied to each output data byte that goes to the outputs. If you code a version of the ornament (or something else) that uses the common-cathode version of this display (the PSC08 series), you should be able to adapt to it by removing the bitwise NOT from the existing code.
|Character||ASCII #d||Segments Lit||Byte High||Byte Low||Decimal Val.|