??? 10/01/03 08:45 Read: times |
#55866 - RE: How to use 7-segments. Responding to: ???'s previous message |
You could use an external decoder/driver chip to do it all for you.
In software, a Lookup Table is the obvious answer. First, you need to determine the bit patterns necessary to light the individual segments; eg, // The seven individual segments are identified as "A" to "G"; // The bit values of the segments are illustrated below: // // A: // 0x01 // ------ // | | // F: 0x20| | B: 0x02 // | G: | // ------ // | 0x40 | // E: 0x10| | C: 0x04 // | | // ------ // D: DP (Decimal Point): 0x80 // 0x08 // // A '1' in a pattern turns the segment 'ON'I then define symbolic constants for each segment: #define SEG_A 0x01 #define SEG_B 0x02 #define SEG_C 0x04 etc, ...You then have to draw out how you want each value to display, and construct your table accordingly; eg, // Lookup table for hex nibble values code unsigned char segments[] = { /* 0 */ SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F , // 0 /* 1 */ SEG_B | SEG_C , // 1 /* 2 */ SEG_A | SEG_B | SEG_D | SEG_E | SEG_G, // 2 /* 3 */ SEG_A | SEG_B | SEG_C | SEG_D | SEG_G, // 3 /* 4 */ SEG_B | SEG_C | SEG_F | SEG_G, // 4 etc,... Simple, eh? You will probably also want to use the 'Search' facility on this forum to search for "multiplexing" (of course, on a Triscend E5, I'd do the whole lot - multiplexing and all - in the configurable logic!) |
Topic | Author | Date |
How to use 7-segments. | 01/01/70 00:00 | |
RE: How to use 7-segments. | 01/01/70 00:00 | |
RE: How to use 7-segments. | 01/01/70 00:00 | |
RE: How to use 7-segments. | 01/01/70 00:00 | |
RE: How to use 7-segments. | 01/01/70 00:00 |