EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Basic examples for Ez430

Started by jackal_204 July 19, 2007
Hi all,

I have just started to use Ez430-F2013 last week. I tested Flashing
LED example but I would like to do more examples with the LED such as
changing the duty cycle or frequency. I am a newbie in C programming
and I want to learn it with more examples. Can you please reply me any
basic information or LED examples that you know about Ez430?

Thanks for advance...

Jack

Beginning Microcontrollers with the MSP430

On Mon, 16 Jul 2007 02:10:32 -0000, Jack wrote:

>I have just started to use Ez430-F2013 last week. I tested Flashing
>LED example but I would like to do more examples with the LED such as
>changing the duty cycle or frequency. I am a newbie in C programming
>and I want to learn it with more examples. Can you please reply me any
>basic information or LED examples that you know about Ez430?

A good way to learn is to try and write some short programs, yourself.
You can start by looking at that LED blinking example that is already
included in the IAR kickstart stuff.

I'd recommend trying to just write a short C program to do these, in
the following order:

(1) Turn the LED on. In other words, just take the blinking code
example and modify it so that it turns on the LED and does
nothing else. This should be easy, but it will require you to
modify that very short C routine and you may learn something in
the process.

(2) Turn the LED off. Same deal as (1), but just making sure you
know where the OFF button is at, so to speak.

(3) Use a busy loop as a delay and turn the LED on and off,
blinking in a 50/50 duty cycle somewhere in the region
of from 3-4Hz to 0.3Hz. In other words, put the C code
back the way it was, mostly.

(4) Play around with the busy loop delay to adjust the
timing in various ways. This just means shortening up
the loop time and lengthening it. Probably easy, but if
so you will get through it quickly.

(5) Now, do the same thing except get rid of the busy wait
loop -- use a timer and toggle the LED when a flag is
raised to indicate the timer has completed a cycle. You
can first do this "polled," which means just monitoring
the status in a loop. This will be a big step. You need
to learn how to set up the timer and to properly use some
of it.

(6) Repeat (5), except get rid of the polling loop and use the
interrupt mechanism, instead. Another big step. You will
need to know how to enable interrupts, generally, and more
specifically with the timer. And you will need to learn how
to set code up so that it is executed when the timer event
occurs. In this first case, just toggle the LED in the
interrupt routine.

(7) Same as (6), except now make the mainline code toggle the
LED on the basis of the flag variable that is set by the
interrupt code. In other words, don't toggle the LED in
the interrupt code, but in the main code.

(8) Do each of the above, but now increase the blink rate until
the LED no longer appears to be blinking but seems solid-on.
Move your head back and forth quickly to see actual blinking
again, if the rate is about 35-45Hz, or so.

By this time, I think you will have a handle on C.

Jon
jackal_204 wrote:
> Hi all,
>
> I have just started to use Ez430-F2013 last week. I tested Flashing
> LED example but I would like to do more examples with the LED such as
> changing the duty cycle or frequency. I am a newbie in C programming
> and I want to learn it with more examples. Can you please reply me any
> basic information or LED examples that you know about Ez430?
>
> Thanks for advance...
>
take a look at our site and our blog for MSP430 information, books and tutorials. Look the DIY projects in our blog.
http://www.msp430.ubi.pt

Humberto Santos

-------------------- m2f --------------------

All MSP430 Stuff at MSP430@UBI (http://www.msp430.ubi.pt)
Manuals, Development Tools, Forum and the Blog

Subscribe to the Blog RSS Feed and stay in touch with the MSP430 news
http://feeds.feedburner.com/Msp430Blog

Sent using MSP430@UBI Forum(http://www.msp430.ubi.pt/forum).

Read this topic online here:
http://www.msp430.ubi.pt/forum/viewtopic.php?p0765#30765

-------------------- m2f --------------------
Hi Jack,

I was recently in the same position you are in. I went through a
series of steps to test/learn. Jon's reply was amazingly similar to
the sequence I went through. As I progressed I eventually got to the
point where I wanted to do more than just think up a blinking pattern
and make it happen. I wanted the blinking pattern to have some
meaning. So I found a TI example of how to read temperature with the
F2013. Once I got the temp (converting to degrees F for use here in
the US) I flashed the LED 1 through 9 times for the ten's digit and
then 0 through 9 for the one's digit (using 10 flashes for 0). I
repeated every 30 seconds or so.

Eventually I changed the pattern so it was sending out the temp in
Morse Code.

I felt my learning of C and the machine was aided by having a non-
trivial goal to work toward.

I guess I never considered the code to be interesting enough to post on
this list, but I have put it on
http://wiscons.com/Wisconsware/MSPProg1.html

Good Luck,
Bryon
--- In m..., "jackal_204" wrote:
>
> Hi all,
>
> I have just started to use Ez430-F2013 last week. I tested Flashing
> LED example but I would like to do more examples with the LED such as
> changing the duty cycle or frequency. I am a newbie in C programming
> and I want to learn it with more examples. Can you please reply me any
> basic information or LED examples that you know about Ez430?
>
> Thanks for advance...
>
> Jack
>

The 2024 Embedded Online Conference