please dont rip this site

C code for 7 segment displays.


// LCD segment definitions. 
// These will need to be changed depending on the 
// wiring of your output port to the segements.
#define a 0x01
#define b 0x10
#define c 0x02
#define d 0x20
#define e 0x04
#define f 0x40
#define g 0x08
#define h 0x80

// LCD Character Generator (stored in Flash).
// Change these defines as needed to make new characters.
const char char_gen[] = {
 a+b+c+d+e+f,   // Displays "0"
 b+c,           // Displays "1"
 a+b+d+e+g,     // Displays "2"
 a+b+c+d+g,     // Displays "3"
 b+c+f+g,       // Displays "4"
 a+c+d+f+g,     // Displays "5"
 a+c+d+e+f+g,   // Displays "6"
 a+b+c,         // Displays "7"
 a+b+c+d+e+f+g, // Displays "8"
 a+b+c+d+f+g,   // Displays "9"
 a+b+c+e+f+g,   // Displays "A"
 0x00,          // Displays  Blank
 a+d+e+f,       // Displays "C"
 a+b+f+g,       // Displays "degrees" o
 a+d+e+f+g,     // Displays "E"
 a+e+f+g        // Displays "F"   
};

#undef a
#undef b
#undef c
#undef d
#undef e
#undef f
#undef g
#undef h
To use this code, simply put the contents of char_gen at the index of the value you wish to display onto the port pins for your 7 segment display:
segments = char_gen[value];
+

Comments:


file: /Techref/microchip/language/C/7segment_C.htm, 1KB, , updated: 2012/2/22 13:30, local time: 2024/11/21 18:22, owner: JMN-EFP-786,
TOP NEW HELP FIND: 
3.145.44.22:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/techref/microchip/language/C/7segment_C.htm"> C code for 7 segment displays.</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .