Announcement

Collapse
No announcement yet.

suggestions for 3 digit 7-segment display counter.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by mariushm View Post
    You can also use some more advanced tricks when it comes to multiplexing leds. For example, here's a way to control 6 leds using 3 io pins.. and it can be extended to 12 leds using 4 io pins, and so on ... but it's more difficult as you can't light up more than 2 leds at a single time (and that's only by accident), so for a 8 digit number, you'd have to go through 8 "refreshes" of the digit in order to draw the digit.



    Here's a project where the guy uses 4 io pins to control 12 leds : https://catmacey.wordpress.com/2011/...ived/#more-511

    It's often not worth it, you have more source code and it's more difficult to multiplex the leds, unless you're really restricted by size it's easier to just go with a larger microcontroller with more io pins.
    Thank you! I originally thought of driving the 7-segment displays (or 8) directly from the PIC, but thought I could save pins by using a bcd to decimal IC or something. I appreciate the information on multiplexing. I don't fully understand it though from what you've posted and have to research it a bit more. Maybe after checking out that link it'll make a bit more since.

    Thanks!

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by stj View Post
    use a serial OLED display.

    or go oldschool, 7segment displays, bcd>7segment drivers and cascaded 4bit up/down counters.

    3 displays,6 chips and about 24 resistors.
    I'll look into the OLED display. That might be the best way to go. I was thinking "old school" because that's what I was taught. We learned about 7-segment displays, etc. We didn't get too in depth with that stuff though. It was more of a beginners class, to get our feet wet.

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by eccerr0r View Post
    This question still plagues me: what exactly do you want to do with this unit? "Serving number X" sign? "X people in queue" sign?

    At one point I was trying to design a 90S2313/Tiny2313 tachometer for the heck of it. I didn't finish it as I didn't really have a need for the device, but it had one tachometer input, RS232 communication, and controlled four 7-seg displays in digital mode or 32 discrete LEDs in "fake" analog mode (where you could place the LEDs in a semicircle to emulate an analog tachometer). In both cases there were enough pins since the 90S2313 had 15 user programmable pins (12 for LEDs, one for tach input, two for rs232)... and no 7447's needed.
    When I was going through college, I took a digital logics class. We had to do a final project. I got an A for mine but never finished it because I lacked the knowledge. Originally, the idea was to make a count-down timer for a very large model rocket I built. Because of the size of the rocket, it was dangerous for us to be near it when the engine ignited, so I was going to make a device where I could enter a number and start a count down, kinda like in the movies where they have those terrorists or some government trained solder setting off bombs (ie, Rambo 3, where Rambo sneaks into the Russian base camp and sets all those little explosives around the base and has them set to 10 minutes).

    I felt finally my level of electronic design had progressed enough where I finally might be able to finish the project, although I don't have a use for the device anymore. More or less to see if I actually learned anything over the years and challenge my mind a bit, that's all.

    Originally posted by eccerr0r View Post
    If you wanted to use an even fewer micro controller pins, you'd need to latch extra bits externally and program them serially... but more ICs and board space needed.
    More stuff to look into I guess. I'd like to use fewer micro controller pins, because I do want to add a touch pad or whatever they're called. I have one lying around, with the buttons 0-9, * and # on it. Was gonna try using that to get the input eventually. To me, I think conserving pins is important. Maybe once I get a prototype running, I'll upload the schematic and you guys could suggest optimizations?

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by eccerr0r View Post
    Shouldn't be a problem to multiplex the digits together with a PIC, only would need 10 pins with a basic implementation (not charlieplexing them). The other pins could be used to detect buttons or be used to count. Based on my stockpile of microcontrollers, an old Atmel 90S2313 (outdated, replaced with Tiny2313) should do just fine. With a bit of pin sharing it shouldn't be too hard to even do 4 digits and still have control buttons.

    The 74C926 should work fine too if you want to go that route. Less programming needed, but yeah up only...
    I want to look more into this multiplexing. I've been trying to be careful about using google. I want advice, like you gave (ie, multiplexing), but I don't want to see a schematic of how someone else did it. Kinda want to see if I can do it myself from scratch and everything. I appreciate the advice.

    I really like how you suggest the Atmel 90S2313. I want to add buttons so I can enter the numbers on a touch pad (0 - 9). Thanks!

    Leave a comment:


  • mariushm
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    You can also use some more advanced tricks when it comes to multiplexing leds. For example, here's a way to control 6 leds using 3 io pins.. and it can be extended to 12 leds using 4 io pins, and so on ... but it's more difficult as you can't light up more than 2 leds at a single time (and that's only by accident), so for a 8 digit number, you'd have to go through 8 "refreshes" of the digit in order to draw the digit.



    Here's a project where the guy uses 4 io pins to control 12 leds : https://catmacey.wordpress.com/2011/...ived/#more-511

    It's often not worth it, you have more source code and it's more difficult to multiplex the leds, unless you're really restricted by size it's easier to just go with a larger microcontroller with more io pins.
    Attached Files
    Last edited by mariushm; 05-15-2017, 07:52 PM.

    Leave a comment:


  • mariushm
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    A simple PIC would do.

    You don't even need binary to decimal converters or whatever you want.
    Think of it like this.. you receive a number between 0 and let's say 999 into the microcontroller and then you have 3 variables.

    nr = 123;
    digit1 = nr / 100; nr = nr - (digit1 * 100); // or nr = nr mod 100;
    digit2 = nr / 10 ; nr = nr - (digit2*10);
    digit3 = nr;

    Now no matter if your led digit is common annode or common cathode, the digits have 8 leds (the 7 segments and the dot).
    So you can just define an array of 10 elements each element being one char / byte that says which segments should be on for each digit from 0 to 9
    IO pins in the microcontroller are arranged in 8 bit ports, so you can simply say something like PORTAbits = mapping[digit1]; to set all i/o pins in PORT A to value from the array called mapping.

    For example, here's a common cathode led digit (meaning all the grounds of leds are tied together): http://uk.farnell.com/broadcom-limit...-cc/dp/1830006




    maybe pin 6 is at the bottom and 10 at the top.. anyway, it's something you can easily figure out with a multimeter in diode mode.

    And to keep things simple, get any PIC that has a full 8 bit port, the first one I found was PIC16F886 : http://uk.farnell.com/microchip/pic1...-28/dp/1439539

    So you have RC0 to RC7 on the micro, which you can set to 0 or 1 in one shot by setting a byte on the PORTC variable.
    So you connect the 8 segments to the RC0 to RC 7 pins in whatever way you want.. for example like this:

    RC0 : 2 (segment F)
    RC1 : 3 (segment G)
    RC2 : 4 (segment E)
    RC3 : 5 (segment D)
    RC4 : 7 (segment DP)
    RC5 : 8 (segment C)
    RC6 : 9 (segment B)
    RC7 : 10 (segment A)

    Whatever you put in the PORTC variable, it will then be like this [ RC7 | RC6 | RC5 ... | RC0 ] ... so basically with one byte you set all segments on or off [ A | B | C | DP | D | E | G | F ]

    So now you can create a 10 element array, from 0 to 9 in memory.

    The first element in the array would hold the mapping for the digit 0 for which you have to turn on all segments except G and DP, so your variable will be

    mapping[0] = 0b11101101; // digit 0
    mapping[1] = 0b01100000; // digit 1 all segments off except B and C
    ...
    mapping[9] = 0b11101011; // digit 9 all segments on except E and DP

    and if you want to write A, B, C, D, E, F you can just extend this array up to 15..

    Pins 1 and 6 are common cathode. What you do is find a npn transistor, connect the common cathode pins to the collector and the emitter goes to ground.. the npn transistor becomes a switch.. when you send power in the base through a resistor to prevent it from burning up, then the segments connect to ground and light up.



    Then in your code you just have a loop and set the segments for a digit, send 1 through the pin connected to the base of a digit's transistor to enable the digit, wait a few ms, turn off the transistor to disable the digit, set the segments for the next digit and enable the transistor for that digit and so on and then loop back to the first digit.

    You'll need 8 + 3 pins, one for each digit. Or 7 + 3 if you ignore the dot.
    There's also displays with 3 or 4 digits that have 10-12 pins or 8 pins per digit + one for each anode or cathode (you'd use something like ULN2003A for common anode digits as would be quite cheap) and you could link the segments of all digits together and multiplex the digits if you want to reduce the number of wires.
    Attached Files
    Last edited by mariushm; 05-15-2017, 07:35 PM.

    Leave a comment:


  • stj
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by eccerr0r View Post
    At one point I was trying to design a 90S2313/Tiny2313 tachometer for the heck of it.
    forget AVR, ARM is the new baseline. and dirt cheap!
    http://www.ebay.co.uk/itm/291693366485

    Leave a comment:


  • stj
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    use a serial OLED display.

    or go oldschool, 7segment displays, bcd>7segment drivers and cascaded 4bit up/down counters.

    3 displays,6 chips and about 24 resistors.

    Leave a comment:


  • eccerr0r
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    This question still plagues me: what exactly do you want to do with this unit? "Serving number X" sign? "X people in queue" sign?

    At one point I was trying to design a 90S2313/Tiny2313 tachometer for the heck of it. I didn't finish it as I didn't really have a need for the device, but it had one tachometer input, RS232 communication, and controlled four 7-seg displays in digital mode or 32 discrete LEDs in "fake" analog mode (where you could place the LEDs in a semicircle to emulate an analog tachometer). In both cases there were enough pins since the 90S2313 had 15 user programmable pins (12 for LEDs, one for tach input, two for rs232)... and no 7447's needed.

    If you wanted to use an even fewer micro controller pins, you'd need to latch extra bits externally and program them serially... but more ICs and board space needed.

    Leave a comment:


  • eccerr0r
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Shouldn't be a problem to multiplex the digits together with a PIC, only would need 10 pins with a basic implementation (not charlieplexing them). The other pins could be used to detect buttons or be used to count. Based on my stockpile of microcontrollers, an old Atmel 90S2313 (outdated, replaced with Tiny2313) should do just fine. With a bit of pin sharing it shouldn't be too hard to even do 4 digits and still have control buttons.

    The 74C926 should work fine too if you want to go that route. Less programming needed, but yeah up only...
    Last edited by eccerr0r; 05-14-2017, 08:24 PM.

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    I wonder if something like the MM74C926 might work: http://www.jameco.com/z/74C926-Major...-18_44599.html

    I don't know if something like that will work though. I don't think I could say hey, start at 57 and count down. From what I've been reading, I think they're just for counting up. Maybe I'm wrong though.

    Leave a comment:


  • suggestions for 3 digit 7-segment display counter.

    Hello,

    I wanted some ideas to see if there's a better way to accomplish this. Let's say I have 3 digit 7-segment LED display and I wanted to have it either count up or down from a predetermined number.

    I had some ideas on how to do this but I'm thinking maybe there's a better way. I was thinking I'd need a PIC with at least 12 I/O pins and I'd set them to output. Then I'd need three BCD (binary coded decimal) to 7-segment decoder / drivers, something like the IC7447, one for each digit.

    The PIC would send out BCD on the I/O pins.

    Is there a better way? Something that doesn't require so many I/O pins? I was thinking maybe one of those LCD dispalys instead of an LED display. What do you guys think?

    In the PIC, I'd have a value set, 100, for example. And then I'd probably have some variable that says either count up or count down. The PIC would then read the variable and then either count up from 0 to whatever value was set or count down from whatever value was set to 0. It'd just loop and either increment or decrement every second. If we're counting up, when the far right display reaches 9, after a second, that display will show 0 and then the middle will show 1.

    I just basically want to make a counter that can display numbers between 0 and 999 (or maybe FFF).

    Thanks.
Working...