# Multiple questions about an electronic dart scoreboard - PIC16F1778-I/SP-MICROCHIP-8 Bit uC

#### Southrend

Joined Dec 28, 2015
5
Hello all,

This is my very first post on this forum, so I think I need to give you some little background info.
I've got no previous experience in designing electronic circuits and I've got some experience in programming (Except not in C, but I think I'll manage). And English isn't my native language, so if a sentence isn't clear, ask and I shall try to explain it better.

I want to build a scoreboard for keeping up the score for two players in a game of darts. It should be able to do the following:
1. Every new game, both the number of points should be 501.
2. Every turn a player can enter his score, press submit and the number of points will be deducted from his score.
It should look a little like this:

Now I've been doing a lot of reading and I came up with the following circuit. And that's where my first problems are starting to appear (I know I haven't got any input for the buttons yet, however I should have enough pins left for that)

Question number 1:
Am I on the right track? Or should I stop now and start all over?

Question number 2:
I'm missing (probably) a lot of resistors. My guess is there should be one on every wire from the BCD output pins to the LED displays input pins. How do I find out which type of resistor I should use?

Question number 3:
Considering the transistors near the bottom of the diagram. Can I use any type of transistor or should I get a specific type? If so, how do I find out which type to use?

Question number 4:
I need a total of 13 buttons to control the scoreboard. I'm planning to put the [enter], [clear] and [0] through [9] on a 3x4 button matrix, so I would only need 7 pins for 12 buttons. The main loop in the program will be monitoring any changes for those input-pins and act accordingly. However I read somewhere that there might be some stutter when I press a button. Should I be worried about that? I can probably fix that within the software or I can fix it in the hardware. What should I do?

There are probably many more questions to follow, but these are the most important ones I think.

#### Dodgydave

Joined Jun 22, 2012
10,050
You will need resistors on each of the led anodes, and transistor bases, for the leds use 330ohms, and transistors use 1k to 6.8k, the switch matrix you can use a 4X4 which will give you 16 inputs.

You could use 9 cd4511 chips, one for each segment, and use four data lines, and 9 Latch enables,13 pins in total, that way you dont need to multiplex the digits.

#### ErnieM

Joined Apr 24, 2011
8,177
I see a few things...

I strongly recommend you leave RB6 and RB7 free so you can program your device in circuit. When you do this you can also use a PICkit (or many other programmers) to debug your code as it runs inside your hardware in real time. Very very helpful to be able to do that!

MCLR should not be tied to VCC, leave it free so you can program and debug. It will then Ned a 10K pull up so the thing works without the programmer attached.

#### djsfantasi

Joined Apr 11, 2010
7,827
However I read somewhere that there might be some stutter when I press a button. Should I be worried about that? I can probably fix that within the software or I can fix it in the hardware. What should I do?
With regard to the stuttering (called switch bounce), referred to in your fourth question, you will have to consider that.

There are two ways of debouncing a switch: hardware and software. This article is a good summary of the problem and presents several hardware solutions. Google also has several references. Two examples of software debouncing can be found here and here (the latter detects short and long presses).

Hope this helps

#### dannyf

Joined Sep 13, 2015
2,197
The basic design is sound: I would put resistors on the segment to limit current.

There are room for simplification. For example, you can tie all the corresponding segments together and drive them with one decoder (or a shift register if you want to minimize pin count). You can even tie the digit pins to a decoder and drive them that way.

#### MMcLaren

Joined Feb 14, 2010
853
Hi Southrend. Welcome to AAC.

I think you have the start of a good design. You need to add resistors, as others have mentioned.

I'm not familiar with the CD4511 but after a quick glance at the Datasheet I believe the CD4511 'LE' (latch enable) pin should be connected to ground in your schematic. Hopefully the guys will jump in here and correct me if I'm wrong.

As an alternative, It looks like you can connect the A/B/C/D inputs together on all three CD4511 ICs and drive each 'LE' pin separately from the PIC. In this case you would set the A/B/C/D pins and generate an active low 'LE' pulse to load data into one CD4511 at a time. Of course you would need to load all three CD4511s before turning on the digit/column driver so the trade-off for saving a few pins is a little more work on the software side.

I also suspect you might be able to connect the '/BL' pins together on all three CD4511 ICs and drive them from a PIC PWM output for brightness control. I've done this on some of my multiplexed display projects but I typically use 8-bit serial-to-parallel driver ICs instead of the CD4511.

Good luck on you project... Cheerful regards, Mike

Last edited:

#### dannyf

Joined Sep 13, 2015
2,197
I believe the CD4511 'LE' (latch enable) pin should be connected to ground.
Not in this particular design: it has to be individually latched as it is a scanning method: you select the digit, output the data onto the decoder and then latch the output to the digit; repeat that process for all 9 digits.

A simpler approach is to tie the segments to one decoder, tie the digits to one decoder, and tie the latches together -> 9 pins and two decoders and one set of resistors.

#### MMcLaren

Joined Feb 14, 2010
853
Not in this particular design: it has to be individually latched as it is a scanning method: you select the digit, output the data onto the decoder and then latch the output to the digit; repeat that process for all 9 digits.
Hi dannyf. I wonder if you might be mistaken? The datasheet suggests the 4511 operates as a transparent latch with  LE low and I found a few examples to back it up. Scanning the OP`s display would involve blanking the display (turn off digit lines), setting correct data on the 12 data lines, and turning on the correct digit (column) line. Rinse and repeat for each colum.

Last edited:

#### dannyf

Joined Sep 13, 2015
2,197
It depends on the particular design, MMcLaren.

In the last one you posted, for example, if all LE pins are tied low, and BL high, the same output will show up on all three decoders. Since the digit pins are tied together (for the three sets of displays), all digit 1's will show the same number, and all digit 2's will show the same number as well, ....

So you either separate the digit pins, or enable individual decoders.

#### MMcLaren

Joined Feb 14, 2010
853
Hi dannyf...

Sorry for the confusion. Of course I was commenting on stefan.54's schematic which had the 'LE' pins tied to 5v. I don't see how that could work. Then, I suggested the alternative of mux'ing the data lines with accompanying diagram which had the 'LE' lines broken out for connection to the PIC. I'm not sure how you might conflate the two schemes but I'll try to be more concise in future posts and perhaps you can do the same.

Cheerful regards, Mike

#### MMcLaren

Joined Feb 14, 2010
853
A simpler approach is to tie the segments to one decoder, tie the digits to one decoder, and tie the latches together -> 9 pins and two decoders and one set of resistors.
Which decoders? Are you taking about a sinking driver and a sourcing driver IC? Or are you talking about the 4511 and a 74HC138 driving a set of transistors for the column drivers? Could you be more concise? Do you have something drawn up that you could share?

Cheerful regards, Mike

#### dannyf

Joined Sep 13, 2015
2,197
Of course I was commenting on stefan.54's schematic which had the 'LE' pins tied to 5v. I don't see how that could work.
I assume you are talking about the very first post (the OP's). There are three decoders (5411), and three digit lines (each connected to three digits). So the timing sequence is this:

1) turn off all digits;
2) output three sets of segment information on three decoders;
3) turn on the corresponding digits -> the segments are lit up now;

Repeat that for all sets of digits (3x) and one display cycle is done.

That's not possible in the 2nd set of schematic, if you have the LE's tied together.

Could you be more concise?
You can think of the segment pins tied all together, and then you drive the digit pins individually. The display sequency would be like this:
1) turn off all digits;
2) send the segment information out;
3) turn on the digit you want to light up.

Repeat that for 8 digits to finish a display cycle.

Now, you can drive the digit pins through another 5411, ...

#### MMcLaren

Joined Feb 14, 2010
853
I assume you are talking about the very first post (the OP's). There are three decoders (5411), and three digit lines (each connected to three digits). So the timing sequence is this:

1) turn off all digits;
2) output three sets of segment information on three decoders;
3) turn on the corresponding digits -> the segments are lit up now;

Repeat that for all sets of digits (3x) and one display cycle is done.
I agree that's how it should work, except that I don't think the circuit would have worked with the 4511 LE pins tied to the +5v bus. Pehaps someone more familiar with the CD4511 could comment?
That's not possible in the 2nd set of schematic, if you have the LE's tied together.
I would think that would be obvious to anyone looking at that drawing.

When I asked you to elaborate on your "simpler" 9-pin 9-digit design, you replied;
You can think of the segment pins tied all together, and then you drive the digit pins individually. The display sequency would be like this:
1) turn off all digits;
2) send the segment information out;
3) turn on the digit you want to light up.

Repeat that for 8 digits to finish a display cycle.

Now, you can drive the digit pins through another 5411, ...
Unfortunately, that description is more "smoke and mirrors" than "concise". I'm not sure what "another 5411" is but if you meant to say "another 4511" then please tell us how you might use a BCD to 7-Segment Decoder IC to drive nine digit lines one digit at a time? Also, how do you connect the circuit to 9 I/O pins? Please, please, please, take all the time you need to provide a thoughtful, credible, accurate, and concise response.

TIA... Cheerful regards, Mike

Last edited:

#### dannyf

Joined Sep 13, 2015
2,197
Unfortunately, that description is more "smoke and mirrors" than "concise".
Since you have been such an %^#\$%, I decided to wipe out the part that you wanted to know and still show you how it can be done.

The content to be displayed is 012345678 and I only implemented digit 1 (displaying '0'), digit 4 (displaying '3') and digit 7 (displaying '6').

#### Attachments

• 36.9 KB Views: 11

#### MMcLaren

Joined Feb 14, 2010
853
More "smoke and mirrors"? You're not going to show us how to make a CD4511 drive nine digit lines one at a time? Aren't we all here to share knowledge and help each other? If this is your "simpler" two decoder 9-pin 9-digit solution, it's kind of disappointing.

Please allow me to apologize for asking you for details about your suggestion. At least now we realize you may not have the time or the resources to support your suggestions and claims.

Cheerful regards, Mike

Last edited:

#### MMcLaren

Joined Feb 14, 2010
853
Hi Southrend. Please let us know how you're progressing.

While you didn't specifically ask for alternative display designs, you should know there are lots of ways you can go and dannyf's suggestion for a 9-digit multiplexed display certainly has merit and is worth your consideration. That said, I came up with an 'untested' design this morning which I suspect may be similar to the "two decoder" design dannyf had in mind. If you think it looks interesting enough to try, you might want to test the design first on a solderless breadboard to check for acceptable brightness with your displays when driven at a 1/9th (~11%) duty cycle with approximately ~1-milliamp "average" current per segment. That's probably the biggest caveat with this design. The display is running at a very low duty cycle and providing very low "average" current but then you'd be surprised how much brightness you can get from modern high-brightness displays.

I couldn't resist trying a design variation that eliminates the CD4511 IC (below). It uses more I/O pins but there are plenty to spare by using the 74LS145 decoder/driver IC as the digit driver. Again, you should test the circuit to see if it provides acceptable display brightness.

I'd be happy to explain the circuit operation if you or other forum members have questions. Also, I realize you want to use a 3x4 keypad so please ignore the switch matrix inset in the first drawing.

Good luck on your project... Cheerful regards, Mike

Last edited:

#### Southrend

Joined Dec 28, 2015
5
Hi MMcLaren, thank you for all those wonderful schematics you made. Since this is a hobby project, I've got to do it in my spare time. And that's another of my problems I've got with this project: Time.

I've still got an alert on this topic so I can see every new reply. I just haven't had the time to rereply those. I'm currently at work, so my reply can't be that long but I want to say I considered your first schematic but I was indeed also worried about the brightness. I hope to receive my displays very soon, so I can test them.

I do have one question, I'm using circuitmaker as my diagram designer. What application are you using?

#### Southrend

Joined Dec 28, 2015
5
Okay, I'm starting to get the supplies I need for building this project. However, I received the wrong kind of 3 digit displays. They're common anodes and from a brand I cannot find any information on.

If I can believe the writing on the displays, they are KEM-5361BR, but I cannot find any information on the internet for these things. However, assuming (is that bad?) that these are some generic 7 segment common anode displays: can I just change my diagram so that pin 8, 9 and 12 are connected to VDD and that those are switched with these transistors?

Or should I just re-order them and then buy the correct ones?

#### MMcLaren

Joined Feb 14, 2010
853
Hi Southrend.

You can't use the CD4511/MC14511 decoder/driver ICs on the cathode segments of a common anode display because the '4511 is a high-side ("sourcing") driver. For common anode displays you would need low-side ("sinking") drivers for the cathode segments and PNP or P-Channel MOSFET high-side sourcing drivers for the common anodes.

There are many different ways to design a display subsystem. Some designers use 8-bit serial-to-parallel driver ICs to drive the segments (where you have the CD4511s in your circuit) and common anode displays are a good choice because almost all of the 8-bit serial-to-parallel driver ICs (Micrel MIC5841, TI TPIC6C595, etc.) are low-side or "sinking" drivers (for the cathode segments). I only know of one 8-bit serial-to-parallel high-side or "source" driver IC (the Micrel MIC5891).

Here's an example with a serial-to-parallel sinking driver IC and common anode displays (below). The software is a little more involved because instead of latching a 4-bit BCD value of 0..9 into a CD4511 and letting it do the BCD to 7-segment decoding, your program would do the decoding by using that BCD 0..9 value to look up the 7-segment data pattern and load that data into the serial-to-parallel drivers.

If you haven't settled on a final design, it may be worthwhile searching for and studying some multiplexed display examples.

Cheerful regards, Mike

Last edited: