I’m not really sure how the code for the Large Digit Driver’s works for this. By Default the display segments are illuminated. I want to turn off all the segments on the large 7 segment displays (2 of them joined) (thus looking like the display is off). How would I do that in the code?
I am using the guide below as a reference. I am using the functions postNumber and showNumber word for word so far. I don’t completely get the shift registries yet.
https://learn.sparkfun.com/tutorials/la … okup-guide
Thanks for any help you guys can offer.
I figued it out. I essentially wanted any zero’s showing up in a number that way below 10 to just be blank (Example: 00, 01, 02. 03, - 09) but those 10 thru 99 to show the zero. I just modified the code slightly for postNumber and got what I wanted.
Old Code:
//Given a number, or '-', shifts it out to the display
void postNumber(byte number, boolean decimal)
{
// - A
// / / F/B
// - G
// / / E/C
// -. D/DP
#define a 1<<0
#define b 1<<6
#define c 1<<5
#define d 1<<4
#define e 1<<3
#define f 1<<1
#define g 1<<2
#define dp 1<<7
byte segments;
switch (number)
{
case 1: segments = b | c; break;
case 2: segments = a | b | d | e | g; break;
case 3: segments = a | b | c | d | g; break;
case 4: segments = f | g | b | c; break;
case 5: segments = a | f | g | c | d; break;
case 6: segments = a | f | g | e | c | d; break;
case 7: segments = a | b | c; break;
case 8: segments = a | b | c | d | e | f | g; break;
case 9: segments = a | b | c | d | f | g; break;
case 0: segments = a | b | c | d | e | f; break;
case ' ': segments = 0; break;
case 'c': segments = g | e | d; break;
case '-': segments = g; break;
}
if (decimal) segments |= dp;
//Clock these bits out to the drivers
for (byte x = 0 ; x < 8 ; x++)
{
digitalWrite(segmentClock, LOW);
digitalWrite(segmentData, segments & 1 << (7 - x));
digitalWrite(segmentClock, HIGH); //Data transfers to the register on the rising edge of SRCK
}
}
New Code:
//Given a number, or '-', shifts it out to the display
void postNumber(byte number, boolean decimal)
{
// - A
// / / F/B
// - G
// / / E/C
// -. D/DP
#define a 1<<0
#define b 1<<6
#define c 1<<5
#define d 1<<4
#define e 1<<3
#define f 1<<1
#define g 1<<2
#define dp 1<<7
byte segments;
switch (number)
{
case 1: segments = b | c; break;
case 2: segments = a | b | d | e | g; break;
case 3: segments = a | b | c | d | g; break;
case 4: segments = f | g | b | c; break;
case 5: segments = a | f | g | c | d; break;
case 6: segments = a | f | g | e | c | d; break;
case 7: segments = a | b | c; break;
case 8: segments = a | b | c | d | e | f | g; break;
case 9: segments = a | b | c | d | f | g; break;
case 0:
if (numentry > 9) {
segments = a | b | c | d | e | f; break;
} else segments = 0; break;
case ' ': segments = 0; break;
case 'c': segments = g | e | d; break;
case '-': segments = g; break;
}
The only change I made was the case 0 and added an if statement doing what I wanted. I couldn’t figure out how to invoke the ’ ’ case switch from within showNumber since it needs an integer. But this worked out great. Hope it helps somebody else one day!
This is probably a simple question, but when I add this to the original code, I get ‘numentry’ was not declared in this space. What do I have to do to make this work?
Thanks.
Murphy