Countdown timer - MSP430

Discussion in 'Embedded Systems and Microcontrollers' started by kgstewar, Sep 20, 2013.

  1. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    Hi all,

    After whetting my appetite for electronics by putting together a scoreboard using 4000 series ICs, I'm ready to explore microprocessors.

    What I want to build is a countdown timer, that will countdown the minutes and seconds (so, four 7-segment numbers with a flashing colon, 2" high would be nice). Starting point will be either ten minutes, or five minutes, user selectable. There should be a reset button, which immediately sets it back to the starting time, and a start/stop button, which does just that, interrupts and resumes the countdown. Once the countdown timer hits zero, it should trigger a buzzer. (This is for an air hockey table so an NHL-sounding horn would be great!).

    After reading a bit, I've settled on the MSP430 and have ordered a Launchpad and a few 20-pin chips (MSP430G2553IN20). My selection was based on the low cost of the Launchpad and chips, Mr. Chips awesome MSP430 blog, and my superficial understanding that the MSP430 is up to the task.

    So, finally, here's my question: Is the system I'm starting with appropriate for my proposed project?

    Many thanks!

    Kevin
     
  2. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I have not used that TI microcontroller, but I think a really good general suggestion these days is to start with something that you can program in C code (not assembly).

    That makes it easier for you to get code examples, easier to build complex projects, and easier for people to help you with your code.

    Re that particular project, you should do a block diagram design and check things like the number of port pins you need etc;
    7 seg lines = 7 pins
    4 digit drivers = 4 pins
    flashing colon = 1 pin
    2 buttons = 2 pins
    buzzer = 1 pin

    So that is already about 15 port pins, which is close to maxing out your 20 pin micro (as there will also be pins used for power and xtal). If it fits, then it fits, but you should consider other future projects or the possibility of adding features etc.
     
  3. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    Thanks for your very helpful answer and I now see that's the way to look at it. 15 pins exceeds the maximum number of pins using the basic Launchpad by one, so I might need to look elsewhere.

    I noticed that there is a new Launchpad out that uses bigger chips (and sells for the amazingly low price of $12.99). Perhaps this would work. What I wonder about bigger TI chips is if they are only available as those postage stamp surface mount packages. If so, I might be out of my league when trying to solder these to a PCB or even figure out how to breadboard them.

    In any case, my basic Launchpad is on it's way and should be fun to play around with. It does use C so hopefully skills I develop on this platform will be transferable to other platforms.

    So now my question has morphed into this: Are there MSP430 chips with >15 I/O pins in a DIP package that can be programmed with newer Launchpad?

    Thanks!

    Kevin
     
  4. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    As I understand the LaunchPad can program all MSP430G2xx Value Line microcontrollers found here http://www.ti.com/lsds/ti/microcontroller/16-bit_msp430/value_line/products.page#p886=16;32
    They offer only 14 and 20 pins DIPs in this series. So if price is important, and at the same time want something that work out of the box. The MSP430F5529 USB LaunchPad Evaluation kit will be a good option. At least if you do not fry to many of them:D If I counted correct you will have about 30+ I/O lines Should be enough for your project. However I think the people using PICs in this forum are in much larger number. But TI has working forum that will help if stuck. But of course feel free to post/cross-post here to
     
  5. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    Many thanks for that info. I guess I need to find out if it is possible to program one of the value line chips with a >20 pin non-dip chip using the basic launchpad. I thought that since the Launchpad only has a 20-pin socket on board, it would be restricted to only those chips. Maybe a larger chip is programmable via a cable?

    Kevin
     
  6. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    If you are going to start juggling programmers, cables, and larger chips, I would suggest starting with PICs instead of the MSP.

    You can get a PICkit2 or 3 cheap enough, and there are free C compilers. PICs are more common, more established, and have many more types of package and features.

    That would require you to make a small PCB etc but you would have to do some soldering anyway for your other items like the 7 seg displays and the 4 transistor drivers etc. You can use a ready made stripboard/veroboard or protoboard PCB, and solder the parts into that.
     
  7. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    Yep, I think the basic MSP430 Launchpad will probably not work for this project. Oh well, very little investment so far and I can certainly build a number of other projects with that system. It does use C so that will help me get my C chops up to snuff. Time to look at PICkits...

    In the meantime, while searching for monolithic clock displays, I ran across this. It seems to be designed for Arduinos, but might this be a way to save pins? It looks like it has an on-board processor of some type that requires very few input pins. I just can't figure out if the inputs it requires are the sorts of things an MSP430 (or PIC) can deliver.

    Kevin
     
  8. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    No get the larger ones. The extra cost is minimal. And you will have more than enough IO. That is more important than speed for a beginner and will make the programming much more simple
     
  9. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    Yep, PICkit it is. Ok time to order one of those. Thanks to all for the guidance!

    Kevin
     
  10. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    You could use it there 16 I/0 and there a arduino ide for it that's works nice with the MSP430
    You could make this work in a weekend.

    Don't get me wrong but PIC's are great and it's great to know how to use them, But it's a big learning curve to use PIC's
    You can use Energia – A simple IDE for LaunchPad http://www.ti.com/lsds/ti/microcontroller/16-bit_msp430/tools_software.page#energia It works great and there bigger chips then the 20 pin one and are really cheap.
     
  11. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    The MSP430 needs only two pins for programming plus power and ground.

    Also you need to recount your I/O lines needed. For the 7-segment output you only need 4 lines if you use an external 7447 BCD-to-7-segment decoder/driver.

    And then of course I would suggest using the MSG430G2553.
     
  12. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Sure, that could be a great option. It is driven with "I2C" data which only needs TWO drive pins from your micro to operate the whole display. It would also help simplify your mechanical construction a lot.

    It should be compatible with your MSP430 PCB, provided you can write or get some I2C driver code (which should be on the Adafruit site anyway).

    Really it depends on how you want to proceed. You can buy modules, and do less soldering/wiring/fiddling, but then you are up for the cost of modules and limited to how the modules function.

    Alternatively, you can work with a microcontroller, do some of your own wiring and circuit design, and although it is more work to get a finished project you get a massive gain in flexibility to make what you want, the way you want.

    At this point, if you don't mind spending $20 here and there for modules you can get up and running quickly, and worry about your future expansion needs later. :)
     
  13. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    Mr. Chips, you have given me hope for continuing to use the MSP430 and I have a couple of the MSG430G2553 chips on the way. So, am I counting right here:

    4-digit display: 4 pins (when using a 7447) + 4 pins for turning on and off each number when multiplexing
    Colon: 1 pin
    Starting time select/reset: 1 pin
    Start/stop button: 1 pin
    buzzer: 1 pin
    32khz crystal: 2 pins

    That's just 14 pins so I think I'm ok with the MSG430G2553?

    Kevin
     
  14. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    Thanks RB, I'll look into the I2C driver code and see if this module can work. If nothing else, might be a good learning experience!
     
  15. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    You didn't read my post did you ?
    You can use Energia – A simple IDE for LaunchPad http://www.ti.com/lsds/ti/microcontr...e.page#energia

    It's free it's for the LaunchPad and oh It has almost every Arduino library
    oh that means I2C
    Oh and it works with this 40 pin chip with USB

    [​IMG]

    The ide is not totally bug free but none is.
    Wire works great I've tried it
    Here a sample
    Code ( (Unknown Language)):
    1. // Wire Master Writer
    2. // by Nicholas Zambetti <http://www.zambetti.com>
    3.  
    4. // Demonstrates use of the Wire library
    5. // Writes data to an I2C/TWI slave device
    6. // Refer to the "Wire Slave Receiver" example for use with this
    7.  
    8. // Created 29 March 2006
    9.  
    10. // This example code is in the public domain.
    11.  
    12.  
    13. #include <Wire.h>
    14.  
    15. void setup()
    16. {
    17.   Wire.begin(); // join i2c bus (address optional for master)
    18. }
    19.  
    20. byte x = 0;
    21.  
    22. void loop()
    23. {
    24.   Wire.beginTransmission(4); // transmit to device #4
    25.   Wire.write("x is ");        // sends five bytes
    26.   Wire.write(x);              // sends one byte  
    27.   Wire.endTransmission();    // stop transmitting
    28.  
    29.   x++;
    30.   delay(500);
    31. }
     
  16. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    My apologies be80be, I did read your post but I am sufficiently ignorant about MCUs that I did not make the connection that Energia -> Arduino -> I2C. And now I know, many thanks.

    Kevin
     
Loading...