Thursday, September 1, 2011

ASCII to Seven-Segment table

With all the fun we have been having with Seven-Segment displays, lately, I decided to create a semi-automated ASCII to Seven Segment table using MS Excel (yeah, yeah... I know!)
You still have to enter the patterns yourself, but the Hex value and a handy string for inclusion in your lookup table are generated automatically.

You can use this chart to display more than just numerals, although some ASCII characters just cannot be rendered in seven segments, and some might be a bit of a stretch, but do with it what you will.

(Note:  This chart will have to be modified slightly if you want to use it with the Vane Display example in an earlier blog-post, because the segments a-g are mapped to bits 1-7, instead of the more conventional 0-6.  You can change the chart, or wire the circuits differently. Your choice)

If you want to make your own spreadsheet, here are the formulae used in the different columns:

Note: In the image below, the first cell containing data (32) is Cell B5

Cell B5:               No formula.  Just input the ASCII code
Cell C5:               =DEC2HEX(B5)
Cell D5:               =CHAR(B5)       (Note- sometimes I substitute text)
Cells E5 to L5:     No formula, enter a "1" for segment ON, and a "0" for segment off
Cell M5:              =BIN2HEX(VALUE(5&F5&G5&H5&I5&J5&K5&L5),2)
Cell N5:              ="0x"&M5&",  // "&D5&IF(HEX2DEC(M5)=0," (npr)","")  (Note- you can cut and paste the result directly into your IDE when you build your lookup table)

Have fun!

No comments:

Post a Comment