hi to all
this is the program for moving meesage display that i download it from this topic .
i want to show my own message
I AM LIREZA MOHAMMADI ) in the output.
what change i shoud do in this program?
/*
MATRIX FORMAT
ROW & COL ACTIVE HI
COL SCAN BY 74LS164
-----------5
-----------4
-----------3
-----------2
-----------1
-------2 1 0
*/
#include <reg51.h>
#include <intrins.h>
#define TRUE 1 /* define logical true / false */
#define FALSE 0 /* values for bit variables */
#define SCROLL_DELAY 60 /* scroll delay */
#define TIMER0_COUNT 0xFADA // 1.1ms
void delay_us(unsigned int d);
typedef unsigned char byte; /* type define objects with */
typedef unsigned int word; /* more classical microprocessor */
code char menu[] =
"\r\n\n\n\n\n\n\n\n\n\n\n\n\n"
"Walking led message display program\n\r"
"___________________________________\n\r"
"Written by Sohail Shahzad\n\n\n\n\r"
"Press:-\n\r"
" s to load the message from the PC terminated in a $/r/n"
" d to display message/r/n/n/n/n";
code unsigned char matrix[59][6]=
{0x00,0x00,0x00,0x00,0x00,0x00, //space
0x00,0x00,0x7d,0x00,0x00,0x00, //!
0x00,0x60,0x00,0x60,0x00,0x00, //"
0x14,0x7f,0x14,0x7f,0x14,0x00, //#
0x32,0x49,0x7f,0x49,0x26,0x00, //$
0x62,0x64,0x08,0x13,0x23,0x00, //%
0x36,0x49,0x35,0x02,0x05,0x00, //&
0x00,0x00,0x00,0x50,0x60,0x00, //'
0x1c,0x22,0x41,0x00,0x00,0x00, //(
0x00,0x00,0x41,0x22,0x1c,0x00, //)
0x2a,0x1c,0x3e,0x1c,0x2a,0x00, //*
0x08,0x08,0x3e,0x08,0x08,0x00, //+
0x00,0x01,0x02,0x00,0x00,0x00, //,
0x08,0x08,0x08,0x08,0x08,0x00, //-
0x00,0x00,0x01,0x00,0x00,0x00, //.
0x02,0x04,0x08,0x10,0x20,0x00, ///
0x3e,0x45,0x49,0x51,0x3e,0x00, //0
0x00,0x21,0x7f,0x01,0x00,0x00, //1
0x27,0x49,0x49,0x49,0x31,0x00, //2
0x22,0x49,0x49,0x49,0x36,0x00, //3
0x0c,0x14,0x24,0x7f,0x04,0x00, //4
0x7a,0x49,0x49,0x49,0x46,0x00, //5
0x3e,0x49,0x49,0x49,0x26,0x00, //6
0x41,0x42,0x44,0x48,0x70,0x00, //7
0x36,0x49,0x49,0x49,0x36,0x00, //8
0x32,0x49,0x49,0x49,0x3e,0x00, //9
0x00,0x00,0x22,0x00,0x00,0x00, //:
0x00,0x01,0x22,0x00,0x00,0x00, //;
0x08,0x14,0x22,0x41,0x00,0x00, //<
0x14,0x14,0x14,0x14,0x14,0x00, //=
0x00,0x41,0x22,0x14,0x08,0x00, //>
0x20,0x40,0x45,0x48,0x30,0x00, //?
0x3e,0x41,0x4d,0x4d,0x39,0x00, //@
0x1f,0x24,0x44,0x24,0x1f,0x00, //A
0x7f,0x49,0x49,0x49,0x36,0x00, //B
0x3e,0x41,0x41,0x41,0x22,0x00, //C
0x7f,0x41,0x41,0x22,0x1c,0x00, //D
0x7f,0x49,0x49,0x49,0x41,0x00, //E
0x7f,0x48,0x48,0x48,0x40,0x00, //F
0x3e,0x41,0x41,0x45,0x26,0x00, //G
0x7f,0x08,0x08,0x08,0x7f,0x00, //H
0x00,0x41,0x7f,0x41,0x00,0x00, //I
0x42,0x41,0x41,0x7e,0x40,0x00, //J
0x7f,0x08,0x14,0x22,0x41,0x00, //K
0x7f,0x01,0x01,0x01,0x01,0x00, //L
0x7f,0x20,0x18,0x20,0x7f,0x00, //M
0x7f,0x10,0x08,0x04,0x7f,0x00, //N
0x3e,0x41,0x41,0x41,0x3e,0x00, //O
0x7f,0x48,0x48,0x48,0x30,0x00, //P
0x3c,0x42,0x46,0x42,0x3d,0x00, //Q
0x7f,0x48,0x4c,0x4a,0x31,0x00, //R
0x32,0x49,0x49,0x49,0x26,0x00, //S
0x40,0x40,0x7f,0x40,0x40,0x00, //T
0x7e,0x01,0x01,0x01,0x7e,0x00, //U
0x78,0x06,0x01,0x06,0x78,0x00, //V
0x7f,0x02,0x0c,0x02,0x7f,0x00, //W
0x63,0x14,0x08,0x14,0x63,0x00, //X
0x60,0x10,0x0f,0x10,0x60,0x00, //Y
0x43,0x45,0x49,0x51,0x61,0x00};//Z
code char TEST_MSG[]="WELLCOME TO ALIREZ MESSAGE $";
sbit LED_CLOCK = P3^2;
sbit LED_DATA = P3^3;
sbit LED_RESET = P3^4;
bit timer0_tick;
/*
use the free-running I timer to multiplex the led displays
*/
void multiplex() interrupt 1 using 1
{
TR0=0;
TL0=(TIMER0_COUNT & 0x00FF);
TH0=(TIMER0_COUNT >>8);
TR0=1;
timer0_tick=1;
}
void main(void)
{
int i,j;
unsigned char row;
unsigned char *dataPtr, *tmpDataPtr;
unsigned char messageLength, currentChar, charOffset, tmpCurrentChar, tmpCharOffset;
char msg[32]; // ram for message max length
unsigned char ledArray[32];
P1=0xFF;
P3=0xFF;
P2=0xFF;
EA =0;
TL0 = (TIMER0_COUNT & 0x00FF);/* timer 0 period 5ms */
TH0 = (TIMER0_COUNT >>8);
TL1=0XFD; //9600 @ 11.0592
TH1=0XFD;
//TMOD &=0xF0;
TMOD =0x21;
SCON =0X50;
ET0=1;
TR1=1;
TR0 = 1; /* enable timer 0 */
EA = 1;
RI=0;
/*
main execution loop, executes forever.
*/
LED_RESET = 0;
LED_CLOCK = 0;
LED_RESET = 1;
P1=0;
while(1){
for(i=0;i<sizeof(TEST_MSG);i++) msg
=TEST_MSG;
for(i=0;i<48;i++) if(msg=='$') break; //calculate length of msg
messageLength = i;
charOffset = 0;
currentChar = 0;
dataPtr = &matrix[msg[0] - 0x20][0];
// this loop is the heart of the scroll
// message is scrolled until a key is hit on the keyboard
while (1) {
// load led array
tmpDataPtr = dataPtr;
tmpCharOffset = charOffset;
tmpCurrentChar = currentChar;
for (i = 0; i <= 31; i++) {
ledArray = *tmpDataPtr++;
if (++tmpCharOffset==0x06) {
tmpCharOffset = 0;
if (++tmpCurrentChar == messageLength)
tmpCurrentChar = 0;
tmpDataPtr = &matrix[msg[tmpCurrentChar] - 0x20][0];
}
}
if (++charOffset == 0x06) {
charOffset = 0;
if (++currentChar == messageLength)
currentChar = 0;
}
dataPtr = &matrix[msg[currentChar] - 0x20][charOffset];
// display led array
row = 1;
for (j = 0;j <= SCROLL_DELAY; j++) {
for (i = 0; i <= 31; i++) {
LED_DATA = (ledArray & row) ? 1 : 0; //invert image by interchng 0:1
LED_CLOCK = 1;
LED_CLOCK = 0;
}
P1 = row;
row <<= 1; // next line to be switched on
if (row==0x80) row = 0x01; // if last line go back to the first line
delay_us(1100);
P1 = 0x00;
}
}//while
}//while
}//----------------end main
void delay_us(unsigned int d){
unsigned int i,m;
m=d/14;
for(i=0;i<m;i++);
}