pezman
unread,Aug 21, 2011, 1:35:25 AM8/21/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Hive76 Discussion
Here's source code for our "HELLO ARLO" POV that we created to welcome
Arlo Guthrie to the Philly Folk Fest. I can guarantee he never saw
it, but it was fun to make nonetheless.
The code uses the TIWRAP headers to simplify the code a bit,
Unfortunately, he TIWRAP routines make for a somewhat inefficient
program, so this baby just barely fits on a launchpad when compiled
for debug mode.
#ifdef IAR_WORKBENCH
#include "io430.h"
#else // CODE_COMPOSER
#include "msp430f2012.h"
#endif
#include "..\TIWrap
\Wiring.h"
void load5x5CharDots(byte c, unsigned char *pDots);
void init5x5Dots(unsigned char *pDots, byte d0, byte d1, byte d2, byte
d3, byte d4);
char msg[] ="HELLO ARLO ";
byte Dots[6];
int msglen = 10;
int charindex=10;
int i;
int j;
void setup(void){
// set up LEDs
pinMode(0,OUTPUT);
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
// turn each LED off
for(i=0; i < 5; i++){
digitalWrite(i,0);
}
Dots[5]=0;
}
void loop(void){
int col;
int row;
charindex++;
if (charindex >= msglen) charindex = 0;
load5x5CharDots(msg[charindex], Dots);
for(col=0; col < 6; col++){
for(row = 0; row < 5; row++){
digitalWrite(row, Dots[col] & 1);
Dots[col]=Dots[col]>>1;
}
delayMilliseconds(2);
}
}
void load5x5CharDots(byte c, unsigned char *pDots){
switch( c ){
case 'A': init5x5Dots(pDots, 0xf,0x14,0x14,0x14,0xf); break;
case 'E': init5x5Dots(pDots, 0x1f,0x15,0x15,0x15,0x11); break;
case 'H': init5x5Dots(pDots, 0x1f,0x4,0x4,0x4,0x1f); break;
case 'L': init5x5Dots(pDots, 0x1f,0x1,0x1,0x1,0x1); break;
case 'O': init5x5Dots(pDots, 0xe,0x11,0x11,0x11,0xe); break;
case 'R': init5x5Dots(pDots, 0x1f,0x14,0x1c,0x9,0x00); break;
default:
init5x5Dots(pDots, 0x00, 0x00, 0x00, 0x00, 0x00); break;
}
}
void init5x5Dots(unsigned char *pDots, byte d0, byte d1, byte d2, byte
d3, byte d4){
pDots[0] = d0;
pDots[1] = d1;
pDots[2] = d2;
pDots[3] = d3;
pDots[4] = d4;
}