LED BOARD USING MSP430G2553 AND ENERGIA

Photo of author

By Jackson Taylor


  • THIS IS LED BOARD OF LARGE DISPLAY
  • APPROXIMATELY 90 TO 180 LED PER LETTER
  • CURRENT MAXIMUM OF 250mA PER CHANNEL
  • LED CURRENT LIMITED TO 6mA BY 2W WATTS RESISTOR PER CHANNEL .(10 TO 22 OHMS)
  • ULN2803 DRIVER USED

CIRCUIT

PROGRAM
//#define count  5
#define pwm P1_0
#define c_1 P1_1
#define c_2 P1_2
#define c_3 P1_3
#define c_4 P1_4
#define c_5 P1_5
#define c_6 P2_0
#define c_7 P2_1
#define c_8 P2_2
#define FADETIME 200
int i,k;
int count=3;
void setup()
{
pins_init();
}
void loop()
{
for(int i=0;i<count;i++)   {  still(); }
for(int i=0;i<count;i++)   { FADE_UP (); FADE_DOWN ();}
for(int i=0;i<count;i++)   { FADE_UP (); FADE_DOWN ();}
for(int i=0;i<count;i++)   { FADE_UP (); FADE_DOWN ();}
blink_more();
for(int i=0;i<count;i++)   {  one_by_one_run_and_fill() ; blink_more();  }
for(int i=0;i<count;i++)   { middle_to_ends_fill(); blink_more(); }
for(int i=0;i<count;i++)  {blink_more(); ends_to_middle_fill();  }
for(int i=0;i<count;i++)  {middle_to_ends_fill();ends_to_middle_fill();  }
for(int i=0;i<count;i++)  {blink_more(); ends_to_middle_fill();  }
for(int i=0;i<count;i++)  {blink_more(); run_when_all_are_on_anti_clockwise(); }
for(int i=0;i<count;i++)  {blink_more();run_when_all_are_on_clockwise();  }
for(int i=0;i<count;i++)  {blink_more();run_when_all_are_on_anti_clockwise();run_when_all_are_on_clockwise();  }
for(int i=0;i<count;i++)   { run_when_all_are_on_clockwise(); }
for(int i=0;i<count;i++)   { clock_run_single(); }
for(int i=0;i<count;i++)   { anticlock_run_single();}
for(int i=0;i<count;i++)   { clock_run_single(); anticlock_run_single();}
for(int i=0;i<count;i++)   { phonedial();}
for(int i=0;i<count;i++)   { clock_fill_empty() ;}
for(int i=0;i<count;i++)   { anti_clock_fill_empty();}
for(int i=0;i<count;i++)   { clock_run_double( );  }
for(int i=0;i<count;i++)   { anticlock_run_double();}
for(int i=0;i<count;i++)   { anticlock_run_single(); clock_run_double( );}
for(int i=0;i<count;i++)   { half_part_chasing(); }
for(int i=0;i<count;i++)   { odd_even_blinking();}
for(int i=0;i<count;i++)   { clock_run_odd_two();}
for(int i=0;i<count;i++)   { anti_clock_run_odd_two(); }
for(int i=0;i<count;i++)   { clock_run_three_nos();}
for(int i=0;i<count;i++)   { anti_clock_run_three_nos();}
for(int i=0;i<count;i++)   { clock_run_three_nos();}
for(int i=0;i<count;i++)   { clock_run_four_nos();}
for(int i=0;i<count;i++)   { anti_clock_run_four_nos();}
for(int i=0;i<count;i++)   { clock_run_four_nos();anti_clock_run_four_nos();}
  /*
*/
}
/*
*/
void FADE_DOWN2 (void)
{
for(int i=FADETIME;i>0;i–)
{
onall();
for(int k=0;k<i;k++)delay_fade();
offall();
for(int k=0;k<FADETIME-i;k++)delay_fade();
}
}
void FADE_UP2 (void)
{
for(int i=0;i<FADETIME;i++)
{
onall();
for(int k=0;k<i;k++)delay_fade();
offall();
for(int k=0;k<FADETIME-i;k++)delay_fade();
}
}
void delay_fade2 (void)
{
  delayMicroseconds(5);
}
void FADE_DOWN (void)
{
for(int i=FADETIME;i>0;i–)
{
onall();
for(int k=0;k<i;k++)delay_fade();
offall();
for(int k=0;k<FADETIME-i;k++)delay_fade();
}
}
void FADE_UP (void)
{
for(int i=0;i<FADETIME;i++)
{
onall();
for(int k=0;k<i;k++)delay_fade();
offall();
for(int k=0;k<FADETIME-i;k++)delay_fade();
}
}
void delay_fade (void)
{
  delayMicroseconds(10);
}
void blink_more(void)
{
  for(int i=0;i<2;i++)   {  blink_all(); }
}
void clock_run_four_nos(void) //anti-clock fill & empty
{
offall();
channel_1 (1);channel_2 (1);channel_3 (1);channel_4 (1); delay1 ();channel_1(0);
channel_5 (1); delay1 ();channel_2(0);
channel_6 (1); delay1 ();channel_3(0);
channel_7 (1); delay1 ();channel_4(0);
channel_8 (1); delay1 ();
}
void anti_clock_run_four_nos(void) //anti-clock fill & empty
{
offall();
channel_8 (1); channel_7 (1);channel_6 (1);channel_5 (1); delay1 (); channel_8(0);
channel_4 (1);delay1 ();channel_7(0);
channel_3 (1);delay1 ();channel_6(0);
channel_2 (1); delay1 ();channel_5(0);
channel_1 (1); delay1 ();
}
void clock_run_three_nos(void) //anti-clock fill & empty
{
offall();
channel_1 (1);channel_2 (1);channel_3 (1); delay1 ();channel_1(0);
channel_4 (1); delay1 ();channel_2(0);
channel_5 (1); delay1 ();channel_3(0);
channel_6 (1); delay1 ();channel_4(0);
channel_7 (1); delay1 ();channel_5(0);
channel_8 (1); delay1 ();
}
void anti_clock_run_three_nos(void) //anti-clock fill & empty
{
offall();
channel_8 (1); channel_7 (1);channel_6 (1);delay1 (); channel_8(0);
channel_7 (1); delay1 (); channel_7(0);
channel_4 (1); delay1 ();channel_6(0);
channel_3 (1); delay1 ();channel_5(0);
channel_2 (1); delay1 ();channel_4(0);
channel_1 (1);
}
void clock_run_single(void) //anti-clock fill & empty
{
offall();
channel_1 (1);    delay1 ();  offall();
channel_2 (1);    delay1 ();  offall();
channel_3 (1);    delay1 ();  offall();
channel_4 (1);    delay1 ();  offall();
channel_5 (1);    delay1 ();  offall();
channel_6 (1);    delay1 ();  offall();
channel_7 (1);    delay1 ();  offall();
channel_8 (1);    delay1 ();  offall();
}
void anticlock_run_single(void) //anti-clock fill & empty
{
offall();
channel_8 (1);    delay1 ();  offall();
channel_7 (1);    delay1 ();  offall();
channel_6 (1);    delay1 ();  offall();
channel_5 (1);    delay1 ();  offall();
channel_4 (1);    delay1 ();  offall();
channel_3 (1);    delay1 ();  offall();
channel_2 (1);    delay1 ();  offall();
channel_1 (1);    delay1 ();  offall();
}
void clock_run_odd_two(void) //anti-clock fill & empty
{
offall();
channel_1 (1);channel_3 (1);    delay1 ();  offall();
channel_2 (1); channel_4 (1);    delay1 ();  offall();
channel_3 (1); channel_5 (1);    delay1 ();  offall();
channel_4 (1); channel_6 (1);    delay1 ();  offall();
channel_5 (1);channel_7 (1);    delay1 ();  offall();
channel_6 (1);channel_8 (1);    delay1 ();  offall();
}
void anti_clock_run_odd_two(void) //anti-clock fill & empty
{
offall();
channel_5 (1);channel_7 (1);    delay1 ();  offall();
channel_6 (1); channel_8 (1);    delay1 ();  offall();
channel_3 (1); channel_5 (1);    delay1 ();  offall();
channel_4 (1); channel_6 (1);    delay1 ();  offall();
channel_1 (1);channel_3 (1);    delay1 ();  offall();
channel_2 (1); channel_4 (1);    delay1 ();  offall();
}
void run_when_all_are_on_clockwise(void) //dial
{
onall();
channel_1(0);    delay1 ();  onall();
channel_2(0);    delay1 ();  onall();
channel_3(0);    delay1 ();  onall();
channel_4(0);    delay1 ();  onall();
channel_5(0);    delay1 ();  onall();
channel_6(0);    delay1 ();  onall();
channel_7(0);    delay1 ();  onall();
channel_8(0);    delay1 ();  onall();
}
void run_when_all_are_on_anti_clockwise(void) //dial
{
onall();
channel_8(0);    delay1 ();  onall();
channel_7(0);    delay1 ();  onall();
channel_6(0);    delay1 ();  onall();
channel_5(0);    delay1 ();  onall();
channel_4(0);    delay1 ();  onall();
channel_3(0);    delay1 ();  onall();
channel_2(0);    delay1 ();  onall();
channel_1(0);    delay1 ();  onall();
}
void odd_even_blinking(void) //dial
{
offall();
channel_1 (1);channel_3 (1); channel_5 (1); channel_7 (1);delay1 ();
offall();
channel_2 (1);channel_4 (1);channel_6 (1); channel_8 (1);  delay1 ();
}
void phonedial(void) //dial
{
offall();
channel_1(1);    delay1 ();   channel_1(0); delay1 ();
channel_1(1);  channel_2 (1);delay1 ();  offall();  delay1 ();
channel_1(1);  channel_2 (1); channel_3 (1);delay1 ();offall(); delay1 ();
channel_1(1);  channel_2(1); channel_3 (1);channel_4(1);delay1 ();offall(); delay1 ();
channel_1(1);  channel_2(1); channel_3 (1);channel_4(1);channel_5 (1);delay1 ();offall(); delay1 ();
channel_1(1);  channel_2(1); channel_3 (1);channel_4(1);channel_5 (1);channel_6(1);delay1 ();offall();delay1 ();
channel_1(1);  channel_2(1); channel_3 (1);channel_4(1);channel_5 (1);channel_6(1);channel_7 (1); delay1 ();offall();delay1 ();
onall();  delay1 ();  offall();   delay1 ();
}
void middle_to_ends_fill(void) //anti-clock fill & empty
{
offall(); delay1 ();
channel_4 (1);channel_5 (1);   delay1 ();
 channel_3 (1);channel_6 (1);   delay1 ();
channel_2 (1); channel_7 (1); delay1 ();
channel_1 (1); channel_8(1);    delay1 ();
}
void ends_to_middle_fill(void) //anti-clock fill & empty
{
offall();
channel_1 (1); channel_8(1);   delay1 ();
channel_7 (1);channel_2 (1);  delay1 ();
channel_6 (1);  channel_3 (1);  delay1 ();
channel_4 (1); channel_5 (1);  delay1 ();
}
void anti_clock_fill_empty(void) //anti-clock fill & empty
{
offall();
channel_8(1);  delay1 ();
channel_7 (1);   delay1 ();
channel_6 (1);   delay1 ();
channel_5 (1);   delay1 ();
channel_4 (1);    delay1 ();
channel_3 (1);   delay1 ();
channel_2 (1);   delay1 ();
channel_1 (1);   delay1 ();
channel_1(0);   delay1 ();
channel_2(0);   delay1 ();
channel_3(0);   delay1 ();
channel_4(0);   delay1 ();
channel_5(0);   delay1 ();
channel_6(0);   delay1 ();
channel_7(0);   delay1 ();
channel_8(0);  delay1 ();
}
void clock_fill_empty(void) //anti-clock fill & empty
{
offall();
channel_1 (1);   delay1 ();
channel_2 (1);   delay1 ();
channel_3 (1);   delay1 ();
channel_4 (1);    delay1 ();
channel_5 (1);   delay1 ();
channel_6 (1);   delay1 ();
channel_7 (1);   delay1 ();
channel_8(1);  delay1 ();
channel_8(0);  delay1 ();
channel_7(0);   delay1 ();
channel_6(0);   delay1 ();
channel_5(0);   delay1 ();
channel_4(0);   delay1 ();
channel_3(0);   delay1 ();
channel_2(0);   delay1 ();
channel_1(0);   delay1 ();
}
void half_part_chasing(void) //anti-clock fill & empty
{
offall();
channel_1 (1);channel_2 (1);channel_3 (1);channel_4 (1);    delay1 ();
offall();
channel_5 (1);channel_6 (1);channel_7 (1); channel_8(1);    delay1 ();
}
void clock_run_double(void) //clock run double
{
offall();
channel_1 (1); channel_2 (1);    delay1 ();  channel_1(0);
channel_3 (1);   delay1 ();  channel_2(0);
channel_4 (1);     delay1 ();  channel_3(0);
channel_5 (1);   delay1 ();  channel_4(0);
channel_6 (1);    delay1 ();  channel_5(0);
channel_7 (1);    delay1 ();  channel_6(0);
channel_8(1);channel_7 (1);   delay1(); channel_7(0);
}
void anticlock_run_double(void) //clock run double
{
offall();
channel_8(1);channel_7 (1);   delay1(); channel_8(0);
channel_7 (1);channel_6 (1);     delay1 ();  channel_7(0);
channel_5 (1);    delay1 ();  channel_6(0);
channel_4 (1);   delay1 ();  channel_5(0);
channel_3 (1);    delay1 ();  channel_4(0);
channel_2 (1);     delay1 ();  channel_3(0);
channel_1 (1);    delay1 ();  channel_2(0);channel_1(0);
}
void one_by_one_run_and_fill(void) //anti-clock fill & empty
{
offall(); delay1();
channel_8(1);   delay1(); channel_8(0);
channel_7(1);   delay1(); channel_7(0);
channel_6 (1);   delay1(); channel_6 (0);
channel_5 (1);   delay1 (); channel_5 (0);
channel_4 (1);   delay1 (); channel_4 (0);
channel_3 (1);   delay1 (); channel_3 (0);
channel_2 (1);   delay1 (); channel_2 (0);
channel_1 (1);   delay1();
channel_8(1);   delay1(); channel_8(0);
channel_7(1);   delay1 (); channel_7 (0);
channel_6 (1);   delay1 (); channel_6 (0);
channel_5 (1);   delay1 (); channel_5 (0);
channel_4 (1);   delay1 (); channel_4 (0);
channel_3 (1);   delay1 (); channel_3 (0);
channel_2 (1);   delay1 ();
channel_8(1);   delay1(); channel_8(0);
channel_7(1);   delay1 (); channel_7 (0);
channel_6 (1);   delay1 (); channel_6 (0);
channel_5 (1);   delay1 (); channel_5 (0);
channel_4 (1);   delay1 (); channel_4 (0);
channel_3 (1);   delay1 ();
channel_8(1);   delay1(); channel_8(0);
channel_7 (1);   delay1 (); channel_7 (0);
channel_6 (1);   delay1 (); channel_6 (0);
channel_5 (1);   delay1 (); channel_5 (0);
channel_4 (1);   delay1 ();
channel_8(1);   delay1(); channel_8(0);
channel_7 (1);   delay1 (); channel_7 (0);
channel_6 (1);   delay1 (); channel_6 (0);
channel_5 (1);   delay1 ();
channel_8(1);   delay1(); channel_8(0);
channel_7 (1);   delay1 (); channel_7 (0);
channel_6 (1);   delay1();
channel_8(1);   delay1(); channel_8(0);
channel_7 (1);   delay1 ();//  channel_7 (0);
channel_8(1);   delay1();
}
void still(void)
{
onall();    delay2(); delay2(); delay2();
}
void blink_all(void)
{
 onall();delay1(); offall();delay1();
}
void delay2(void)
{
 delay(100);
}
void delay1(void)
{
 delay(100);
}
void onall(void)
{
P1OUT=0xff;  P2OUT=0xff;
}
void offall(void)
{
  P1OUT=0;  P2OUT=0;
}
//channel states
void channel_1(boolean state)
{
 digitalWrite(c_1,state);
}
void channel_2(boolean state)
{
 digitalWrite(c_2,state);
}
void channel_3(boolean state)
{
 digitalWrite(c_3,state);
}
void channel_4(boolean state)
{
 digitalWrite(c_4,state);
}
void channel_5(boolean state)
{
 digitalWrite(c_5,state);
}
void channel_6(boolean state)
{
 digitalWrite(c_6,state);
}
void channel_7(boolean state)
{
 digitalWrite(c_7,state);
}
void channel_8(boolean state)
{
 digitalWrite(c_8,state);
}
void pins_init(void)
{
   P1DIR = 0xFF;P2DIR = 0xFF;
  offall();
}

See also
PWM BASED LIGHT WAVES USING MSP430G2553 FOR CHRISTMAS CRIB