When we design a PCB for a project that includes a 7 segment display, the usual practice is to connect the port pins to the segments in the most convenient way to avoid or minimize jumpers. Then we calculate the byte values for displaying the digits, based on which port pin is connected to which segment. To simplify these calculations, I have created a tool in Excel; you merely enter the segment names (and the decimal point if needed) against the port pins 0 to 7. The Excel tool performs all the required calculations and provides the byte values separated by commas as a text string that can be just copied and pasted into the code.
If you are using 14 pin PICs like 16F676 which have only 6 pins per port, you cannot assign all the segments to a single port. But it is possible to split the segments between the ports. For example, in 16F676, you can enter segments a, b, c & d against pins that you can use from port A and hyphens for the remaining 4 boxes in the tool. You will get the byte values for port A. By entering the remaining segments against the available port C pins, you can get the byte values for port C. Hyphens are to be entered against port pins that are not used for the display.
The necessary instructions are given in the worksheet itself. The second sheet shows the pinout of common 7 segment display modules - single digit to 4 digits that you may find useful. The worksheet is protected in order to avoid accidental deletion or overwriting of any cell contents. If you would like to make changes in an attempt to improve the tool, you may do so after unprotecting the sheet.
File attached: 7-Segment Display Byte Value and Pinout.xlsx.txt (After downloading the file, rename it by deleting the ".txt" at the end.)
Your comments and suggestions are welcome.
Regards,
Bala
Bookmarks