need help in vertical scroll 7x32 matrix with pic18f2550 and 74hc595 shift register

Thread Starter

anoopmb25

Joined Jan 15, 2011
17
hi,

i created a 7X32 led matrix for text scrolling with the tutorial posted in Embedded Lab .com

MCU IS PIC 18F2550
CRYSTAL 20 MHZ

7 rows are scanned with cd4017 and goes to uln2803 and to matrix
32 columns are driven by chained 4 74hc595 shift registers

I can scroll text from right to left without any problem

I need help to
- scroll text from left to right
- scroll text vertically both upwards and downwards
-show some efects or animaions like fading,step in, sweep in etc..
-start scrolling from right end and stops at left end up to a defined time delay
-scroll one text vertically and others static mode

my code in mikroc is given below

Code:
sbit Serial_Data at RA0_bit;
sbit SH_Clk at RA1_bit;
sbit ST_Clk at RA2_bit;
sbit CD4017_Clk at RA2_bit;
sbit CD4017_RST at RA1_bit;

const unsigned short CharData[][7] =
{
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x20, Space
{0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04} , // 0x21, !
{0x09, 0x09, 0x12, 0x00, 0x00, 0x00, 0x00}, // 0x22, "
{0x0a, 0x0a, 0x1f, 0x0a, 0x1f, 0x0a, 0x0a} , // 0x23, #
{0x04, 0x0f, 0x14, 0x0e, 0x05, 0x1e, 0x04} , // 0x24, $
{0x19, 0x19, 0x02, 0x04, 0x08, 0x13, 0x13} , // 0x25, %
.............................................................................
{0x00, 0x00, 0x11, 0x0a, 0x04, 0x0a, 0x11}, // 0x78, x
{0x00, 0x11, 0x11, 0x0f, 0x01, 0x11, 0x0e}, // 0x79, y
{0x00, 0x00, 0x1f, 0x02, 0x04, 0x08, 0x1f}, // 0x7a, z
{0x06, 0x08, 0x08, 0x10, 0x08, 0x08, 0x06}, // 0x7b, {
{0x04, 0x04, 0x04, 0x00, 0x04, 0x04, 0x04}, // 0x7c, |
{0x0c, 0x02, 0x02, 0x01, 0x02, 0x02, 0x0c}, // 0x7d, }
{0x08, 0x15, 0x02, 0x00, 0x00, 0x00, 0x00} // 0x7e, ~

};
unsigned short Buffer[7][5] = {
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0}
};

unsigned int speed, StringLength;
unsigned short i, l, k, row, scroll, temp, shift_step=1;
unsigned short m, SerialConnect=0, UserIP = 0;

const unsigned char default_message[]="hello world";

void Send_Data(unsigned short rw){
unsigned short Mask, t, num, Flag;
for (num = 0; num < 5; num++) {
Mask = 0x01;
for (t=0; t<6; t++){
Flag = Buffer[rw][num] & Mask;
if(Flag=0) Serial_Data = 0;
else Serial_Data = 1;
SH_Clk = 1;
SH_Clk = 0;
Mask = Mask << 1;
}
}

// Apply clock on ST_Clk
ST_Clk = 1;
ST_Clk = 0;

}

void scrollleft()
{
StringLength = 11;//hello world
for (k=0; k<StringLength+4; k++){
for (scroll=0; scroll<(7/shift_step); scroll++) {
for (row=0; row<7; row++){
index = default_message[k];
temp = CharData[index-32][row];
Buffer[row][4] = (Buffer[row][4] << Shift_Step) | (Buffer[row][3] >> (7-Shift_Step));
Buffer[row][3] = (Buffer[row][3] << Shift_Step) | (Buffer[row][2] >> (7-Shift_Step));
Buffer[row][2] = (Buffer[row][2] << Shift_Step) | (Buffer[row][1] >> (7-Shift_Step));
Buffer[row][1] = (Buffer[row][1] << Shift_Step) | (Buffer[row][0] >> (7-Shift_Step));
Buffer[row][0] = (Buffer[row][0] << Shift_Step)| (temp >> ((7-shift_step)-scroll*shift_step));
}
speed = 15;
for(l=0; l<speed;l++){

CD4017_Rst = 1;
CD4017_Rst = 0;

for (i=0; i<7; i++) {

Send_Data(i);
CD4017_Clk = 1;
CD4017_Clk = 0;
Delay_ms(1);

} // i
} // l
} // scroll
} // k


}

void main() {
CMCON = 0x07; // Disable comparators
ADCON0 = 0x00; // Select ADC channel AN0
ADCON1 = 0b00001110; // RA0 as analog input
TRISC = 0x00;
TRISB = 0xFF;
TRISA = 0x01;

while(1){

scrollleft();

}



}

kindly help me to do above stated actions

sorry for my bad english and thanks in advance

Moderators note : Please use code tags for pieces of code
 
Last edited by a moderator:
Top