Scrolling_Message_LED_Program_File
Scrolling_Message_LED_Program_File
Here is a typical data sheet of Dot matrix displays with the above
images.
Refreshing the Matrix Display
From the circuit diagram of the matrix displays, it is clear that any
LED can be controlled only by the Row and Column terminals. So, in
order to show a symbol or character through the LEDs, it is not
possible to continuously turn ON all the LEDs corresponding to the
character all the time. The LEDs should be addressed and controlled
using individual pixels of the matrix.
The matrix displays are similar to the Matrix keypads and are
interfaced in the same way, the only change is that both the rows
and columns are viewed as Output terminals. So, to display a
character on the matrix, the information should be sent to the
matrix either column by column or row by row. This is known as
refreshing. Below video shows digit zero at a slower refresh rate.
Now, let’s reduce the I/O Pins required to control the rows of the
display array. This is done by using ‘Serial-In Parallel-Out’ shift
registers. This register receives the input data serially and loads
data at its output port i.e., at the parallel outputs. By using this type
of data transmission, only 4-Pins of the microcontroller are required
to send the rows data to the entire display array.
Below is the program file of the display. The program is written for
16 Modules. If the number of modules is reduced to 8 or lesser, then
the repeat loop should be multiplied with 10 instead of 5 for proper
speeds. This is just to vary the speed or it can be ignored if the
speed is satisfactory. There is c font verification function to see the
characters one by one.
char j=16,i,strlent=0,column,row_data_index;
char n_modules=16; //No.of 8X8 Modules or (No.of columns)/8
int scroll,temp2,k;
void font_verification(void);
void line(const char txt[255]);
void text_framing(void);
void framing(void);
void set_framing(void);
PORTC=0X00;
DDRC=0XFF;
OCR1AH=0X3D;
OCR1AL=0X09;
OCIE1A_BIT=1;
EICRA=0X0A;
EIMSK=0X03;
SREG_I_BIT=0;
//line("www.circuitstoday.com");
line("WWW.CIRCUITSTODAY.COM");
//line("ABC");
SREG_I_BIT=1;
if(PIND4_BIT==0)
{
scrolling=0;
for(temp=0;temp<n_modules;temp++)
{
SPDR=0; //Send empty data to columns
do{}while(flag==0); //Wait for TX Complete interrupt
flag=0;
}
PORTC1_BIT=1;
Delay_us(2);
PORTC1_BIT=0;
Delay_us(2);
}
column=1;
temp=0;
scroll=0;
temp1=0;
text_framing();
SREG_I_BIT=1;
Delay_us(5);
while(1)
{
for(temp2=0;temp2<5*repeat;temp2++)
{
PORTC0_BIT=1; //Issue master reset signal to decade counter
Delay_us(2);
PORTC0_BIT=0;
for(column=1;column<=8;column++)
{
for(temp=0;temp<n_modules;temp++)
{
row_data_index=column+(8*temp);
row_data_index+=scroll;
if(row_data_index<=length)
{
SPDR=rowdata[row_data_index];
}
else
{
SPDR=0X00;
}
do{}while(flag==0); //Wait for TX Complete interrupt
flag=0;
}
PORTC1_BIT=1; //STROBE Input ==> Negative edge
Delay_us(2);
PORTC1_BIT=0;
Delay_us(2);
PORTB1_BIT=1; //Enable Shift Register Outputs
Delay_us(250); //Wait=Refreshing ON time
PORTB1_BIT=0; //Disable Shift Register Outputs
Delay_us(2);
void text_framing(void)
{
char j,k,empty_column;
int c;
if(scrolling==0)
{
c=1;
}
else
{
for(c=1;c<=n_modules*8;c++)//Issue of empty data to start the text from Right end
{
rowdata[c]=0X00;
}
//c=1;
}
for(j=0,k=0;text[j]!=13;c++)
{
rowdata[c]=characters_font1[text[j]-32][k];
k++;
if(rowdata[c]==0X00) //End of character's data
{
empty_column=1;
if(text[j]!=32) //End of character's data
{
k=5;
}
}
if(k==5)
{
j++; //Go to next chaaracter
k=0; //Reset character's array index
//Inserting space between two characters in a word
if(empty_column==0) //Character is 5-Columned
{
c++;
rowdata[c]=0X00; //Insert empty column
}
else //Character itself contains empty column at the end
{
empty_column=0;
}
}
}
length=c; //Text contains c no.of columns including initial empty data
for(j=0;j<8*n_modules;j++,c++)
{
rowdata[c]=0X00;
}
}
void font_verification(void)
{
for(j=0;j<97;j++)
{
for(k=0;k<=1000;k++)
{
PORTC0_BIT=1; //Issue master reset signal to decade counter
Delay_us(5);
PORTC0_BIT=0;
for(i=0;i<=4;i++)
{
SPDR=characters_font1[j][i];
do{}while(flag==0); //Wait TX Complete interrupt
flag=0;
PORTC1_BIT=1; //STROBE Input ==> Negative edge
Delay_us(2);
PORTC1_BIT=0;
Delay_us(2);
PORTB1_BIT=1; //Enble Shift register outputs
Delay_us(200); //Refreshing ON-Time
PORTB1_BIT=0; //Disable Shift register outputs
PORTB0_BIT=0; //Issue clock signal to decade counter
Delay_us(5);
PORTB0_BIT=1;
}
}
}
}