ahmad2005
Member level 1
- Joined
- Mar 30, 2011
- Messages
- 40
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,288
- Location
- Mirpur,Dhaka,Bangladesh
- Activity points
- 1,618
What is the problem of this coding ? why Alphabets are not displayed correctly ?
View attachment Moving dot matrix.zip
Code:
char i, error, byte_read; // Auxiliary variables
int cnt;
unsigned short Alphabets[40]={ //0xFF, 0x01, 0xEE, 0xEE, 0xEE, 0x01, 0xFF, 0xFF, //A
//0xFF, 0x00, 0x76, 0x76, 0x76, 0x89, 0xFF, 0xFF, //B
0xFF, 0xC0, 0xF6, 0xF6, 0xF6, 0xFE, 0xFF, 0xFF,//F
0xFF, 0xE0, 0xDF, 0xDF, 0xDF, 0xE0, 0xFF, 0xFF, // U
0xFF, 0xC0, 0xF6, 0xF6, 0xF6, 0xC9, 0xFF, 0xFF, // R
0xFF, 0xC1, 0xF6, 0xF6, 0xF6, 0xC1, 0xFF, 0xFF, //A
0xFF, 0xC0, 0xFD, 0xFB, 0xFD, 0xC0, 0xFF, 0xFF, //M
};
unsigned short count, column, num, repeat;
sbit Serial_Data at RC2_bit;
sbit SH_Clk at RC6_bit;
sbit ST_Clk at RC7_bit;
sbit CD4017_Clk at RA2_bit;
sbit CD4017_RST at RA1_bit;
void send_data(unsigned int temp){
unsigned int Mask = 0x01, t, Flag;
for (t=0; t<8; t++){
Flag = temp & 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 main() {
TRISB=0x00;
PORTB=0;
TRISC=0x00;
PORTC=0x00;
TRISA=0x00;
PORTA=0x00;
delay_ms(100);
//send_data(0xBD);
//send_data(0xFF);
while(1)
{
for (num=0; num<1; num++) {
for (repeat=0; repeat<100; repeat++){
column = 1;
cnt=0;
//PORTB.RA2=1;
for(count = num*40;count < (num*40+40);count++){
PORTB=0;
send_data(Alphabets[count]);
//PORTB=cnt;
PORTA.RA1=0;
PORTB = column;
Delay_ms(1);
PORTA.RA1=1;
column = column<<1;
//cnt++;
}
}
}
}
}
View attachment Moving dot matrix.zip