Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

ez430-F2013 PWM LED Test

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
719 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Feb 16, 2011

Two LEDs fade in and out. The C code uses loops within loops to create a pulse with a set frequency and cycling duty cycle.

The ez430 dongle had been cut to expose the headers that I soldered to the target board.

Simple stuff, but you have to start somewhere.

Here is the code that I wrote and debugged with CCS4, feel free to pick holes in it:

#include "msp430f2101.h"

int main(void)
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR |= 0x02;
P1DIR |= 0x04;

for (;;)
{ volatile unsigned int i; volatile unsigned int n; n = 256; do{ n = n - 4; P1OUT = 0x00; i = 256; do{ i--; if (i - n){ P1OUT = 0x02; } else { P1OUT = 0x04; } } while (i != 0); } while (n != 0); do{ n = n + 4; P1OUT = 0x00; i = 256; do{ i--; if (i - n){ P1OUT = 0x02; } else { P1OUT = 0x04; } } while (i != 0); } while (n != 256);

}
}

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (2)

Sign In or Sign Up now to post a comment!
  • good effort! keep it up!!

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more