Connecting buttons with MSP430F2013 for Input Output with software

Hi! I want to connect 5 buttons with the MSP430F2013 MCU . I want to use the buttons for input with a software . Please help and tell me how to go about the task . If you have any tutorial , curcuit diagrams , videos please give the download location or the url of the site .

Regards Anmol

Reply to
anmol
Loading thread data ...

Study project - homework?

--

Tauno Voipio
Reply to
Tauno Voipio

It's a project but not a school or college project . Please help me in connecting the buttons with MCU for input to software .

Thanks Anmol

Reply to
anmol

Everything you need is in the data sheet and the User's Guide. You'll also find plenty of application information on the TI web site. If you are really stuck, try the MSP430 Yahoo group.

Leon

Reply to
Leon

Your question just _sounded_ so much like an end-of-year "do my work for me" sort of question...

If you have enough undedicated pins, hook up one switch per pin (view with a fixed-width font):

VCC + | | .-. | | | | to '-' processor | o------------o | o | |- o | | | === GND (created by AACircuit v1.28.6 beta 04/19/05

formatting link

This circuit will read as a '1' on the input pin's bit when the switch is open, and '0' when it is closed. It will also introduce you to the wonderful world of switch bounce, which you can find out about via web searches.

There are a lot of ways to deal with switch bounce in software, but basically you need to read the switch, then _make sure_ that it has finished deciding whether it's a '1' or a '0' before you do anything with it. The best way for your application depends on your application, so I suggest you read up on the many ways to debounce switches before you choose which method to use.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html
Reply to
Tim Wescott

Sorry Tim if i sounded arrogant but i was trying to sound that . Thanks for the reply and also for correcting me as this one is my first post in any of the groups . Once again thanks for taking out time and writing a reply :)

Reply to
anmol

Sorry Tim if i sounded arrogant but i was not trying to sound in that manner . Thanks for the reply and also for correcting me as this one is my first post in any of the groups . Once again thanks for taking out time and writing a reply :)

Reply to
anmol

If you can get the EZ430-F2013 ($20 last I checked without a coupon discount), you might already have most of what you'd need not only to write code and program the device but also to wire in your switches as Tim suggested. It plugs into a USB port on your computer and can use the IAR Kickstart IDE and compiler for programming in assembly, c, or c++ or some combination of those. There are some through-holes inside the tiny device and a small open rectangle in the side for bringing out signal wires for your switches and a ground/Vcc that you might take advantage of to get started quickly. The unit includes a small green LED inside the case, as well, that you can use for blinking or some other indicator as you may want.

If that device isn't inappropriate for your needs, I can provide a small tutorial set of programs I wrote to get you started using the device, but they do NOT deal with switches. They are written in c and intended to let you learn about controlling the LED in various ways. But they do get you learning about controlling the CPU speed and using the timer. Which may help in its own way.

...

Separately, depending on how you intend using switches and what kinds of external components you are willing to include, you can also consider learning about various topologies in wiring up switches. Tim wisely held to the simplest and most independent approach -- a switch and a pull-up resistor -- but there are other methods you can also consider if the number of switches grows and the number of I/O pins available is constrained. The whole subject of switches, push button and otherwise, and microcontrollers is a very interesting one in its own right and a very good one to use in learning about micros, software, and various hardware design approaches for user input via buttons. Debouncing is an very important part, but it's not the only interesting aspect. Enjoy it, fully.

Jon

Reply to
Jonathan Kirwan

[Schematics of pull-up resistor and switch]

Just an addition to Tim's post. I don't know about the MSP430F2013 specifically, but many microcontrollers already have the resistor internally on some of the pins. All you need to do is enable it somehow. On AVRs it is done by writing to a port configured as inputs, but I'm sure each manufacturer has some unique, equally wacky way to do it.

So before you warm up your solder iron, it might pay to check out the data sheet carefully.

--
Pertti
Reply to
Pertti Kellomäki

Many do, though the pull-up may be a bit weak.

Some even have several ways to enable the same thing, in fact. ;)

Always good advice!

Jon

Reply to
Jonathan Kirwan

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.