Problem with LED matrix multiplexing

Thread Starter

Tim Weri

Joined Sep 6, 2012
15
Circuit file
Rich (BB code):
#include<at89x52.h>
sbit DATA = P0^0;
sbit SCK = P0^1;
sbit SCL = P0^2;
	unsigned char code hang[]={
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xC3,0xBD,0xBD,0xBD,0xBD,0xBD,0xBD,0xC3,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
	};
unsigned char cot[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
int n,k;
void delay(unsigned long time)
{
	while(time--)
	{
		_nop_();
	};
}
void quet(unsigned char x)
{
	unsigned char i, temp;
	for (i=0;i<8;i++)
	{
	SCK	= 0;
	temp = x;
	temp = temp&0x80;
	if (temp==0x80)
		DATA = 0;
	else DATA = 1;
	x*=2;
	SCK = 1;
	}															 **
}
void main()
{
	while(1)
	{

	for(n=0;n<8;n++)
	{
	SCL = 0;
	quet(0xFF);
	quet(0xFF);
	quet(0xFF);
	quet(hang[4*8 + n]);
	P2 = ~cot[n];
	SCL = 1;
	}
	}
}
I'm working on how to use 89x52 and 74HC595 to multiplex a 8x32 LED matrix. I was able to use column scanning method, but when I changed to row scanning, it went awful. Even when I remove the delay, it still scans really slow. Is it because of my circuit design ? I need help. Thank you in advance.
P.S: I want to master both row and column scanning so, please, don't suggest using column scanning...
 
Last edited:

absf

Joined Dec 29, 2010
1,968
your proteus version is higher than mine so I cant open your DSN file.

You can go to "\edit\copy to clipboard" then open with "paint" and save the picture as .PNG file and upload it here so others can see your schematic.

Not everyone uses proteus here.

Like this.....

Allen
 

Attachments

Last edited:

Thread Starter

Tim Weri

Joined Sep 6, 2012
15
Oh god, I just realized the reason why it scans so slow. My CPU cannot handle the simulation, so it takes a whole minute to animate 1 sec. Well, I still need somebody to check my schematic though. Thank you.
 

absf

Joined Dec 29, 2010
1,968
I'd put 1K resistors between the base of Q1-Q8 to port 1 pins.

D1 would be quite dim with 2.2K resistor. Was it used as a power on indicator?

Allen
 

Thread Starter

Tim Weri

Joined Sep 6, 2012
15
yeah, it's the power indicator. And you are right, I am gonna change the indicator's components into a red LED and a 320 ohms resistor, all of the circuits use a 5V power supply. Does that sound fine? I am rechecking the transistor properties... It' a little confusing ...
 
Last edited:

takao21203

Joined Apr 28, 2012
3,702
I would remove all the resistors and use digital MOSFETs instead.

For the software, use a memory image of the matrix, then only update one scanline each refresh cycle. If you want to swap X/Y, you need to remap the data from the memory image.
 
Top