bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
Hello friends,
I tried to light up LED 8x8 matrix common anode,
The circuit diagram below
Why isn't it diplayed correctly, there's a "shadow" on the character and can not fix on it's place ( the column), anyone can assist me ? thanks a lot
And the code :
====
#include <REG51.H>
//#define Row P2
//#define Column P3
unsigned char pat[8] = {0x3C,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x3C}; //H
void delay_ms(unsigned int msec) //delay function
{
//;
unsigned int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1;j++);
}
void main () {
unsigned int cnt, col, row ;
P1 = 0x00 ; /* Initialize all P1 outputs to be low */
P3 = 0x00;
while(1)
{
for (cnt = 0 ; cnt < 8 ; cnt ++ )
{
row = 1;
//for (col = 1 ; col >0 ; col<<= 1)
for (row = 1 ; row < 0xFF ; row<<= 1)
{
P1 = ~row; // try to reverse the port ?
P3 = pat[cnt];
delay_ms(2) ; // delay of 1 ms
}
}
}
}
I tried to light up LED 8x8 matrix common anode,
The circuit diagram below
Why isn't it diplayed correctly, there's a "shadow" on the character and can not fix on it's place ( the column), anyone can assist me ? thanks a lot
And the code :
====
#include <REG51.H>
//#define Row P2
//#define Column P3
unsigned char pat[8] = {0x3C,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x3C}; //H
void delay_ms(unsigned int msec) //delay function
{
//;
unsigned int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1;j++);
}
void main () {
unsigned int cnt, col, row ;
P1 = 0x00 ; /* Initialize all P1 outputs to be low */
P3 = 0x00;
while(1)
{
for (cnt = 0 ; cnt < 8 ; cnt ++ )
{
row = 1;
//for (col = 1 ; col >0 ; col<<= 1)
for (row = 1 ; row < 0xFF ; row<<= 1)
{
P1 = ~row; // try to reverse the port ?
P3 = pat[cnt];
delay_ms(2) ; // delay of 1 ms
}
}
}
}
Last edited: