Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
 Andy Neil10/01/03 02:45Read: 3465 timesBasingstokeUk #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,Save This Code```// 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:Save This Code```#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,Save This Code``` // 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!)

List of 5 messages in thread
 Topic Author Date How to use 7-segments. Jose Luis 10/01/03 02:13 RE: How to use 7-segments. Andy Neil 10/01/03 02:45 RE: How to use 7-segments. Félix Díaz 10/01/03 12:51 RE: How to use 7-segments. Seema Oshi 10/02/03 03:23 RE: How to use 7-segments. Andy Neil 10/02/03 05:43

Back to Subject List