Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

LED Matrix Display with 4094 Shift Register

Status
Not open for further replies.

kirangowle

Member level 3
Member level 3
Joined
Apr 6, 2010
Messages
65
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
Bangalore
Visit site
Activity points
1,632
Hello,

I am writing code for LED matrix which as 60 col * 7 Row(420 leds).
I have attached complete schematic of LED matrix as a reference.
I dont know how to refresh the display.
Code:
void main ()
{
clk=0;
        Data=0;
        OE=0;
        OE=1;
while(1)
{        
Data=1;
P1=0x7F; // 7F to glow single col LEDs(0111 1111)
clk=1;
delay(2);
clk=0;

Data=0;
//P1=0x00; //  to glow single col LEDs(0000 0000)
clk=1;
delay(20);
clk=0;


Data=1;
P1=0x70; // 70 to glow single col LEDs(0111 0000)
clk=1;
delay(2);
clk=0;

for(z=0;z<59;z++)
{
Data=0;
//P1=0x00; // 7F to glow single col LEDs(0111 1111)
clk=1;
delay(20);
clk=0;

}
       
}      
}

With respect to abv code i should get output someting like this
0 0 1
0 0 1
0 0 1
0 0 1 and it will be keep on scrolling from left to right
1 0 1
1 0 1
1 0 1

But actual i am getting as below:evil:
0 0 0
0 0 0
0 0 0
0 0 0 and it will be keep on scrolling from left to right
1 0 1
1 0 1
1 0 1
 

Attachments

  • MOVING DISPLAY CIRCUIT(1).pdf
    1.5 MB · Views: 384

First,Do you know the matrix display how to work?operating principle is very important.

- - - Updated - - -

First,Do you know the matrix display how to work?operating principle is very important.
 
CD4094 same as 74HC595,
About display refresh :
step1.Choose firt row,and shift first row data to 4094/595,and then lock and enable output,after enable out put must delay some time;
step2.Choose No.2 row and just like step1
.......
if finish all rows,return step 1,
 
How does first Row gets shifted.. I think it should be first Column.
when you shift 1 bit towards right entire column will be shifted. and if i send a next col value the current value is being displayed and its shifted one bit right(You will loose the first information). To avoid this i need to refresh the display in very quick
 

i am considering that your colum is connected to controller port ,and colum is connected to uln .
so first we will do the basic think . shift led from left to right . for that first write a function for clean data in shift register .
then make your colum high and shift the register . note that in your program i found you are give data 0 and 1.
consider all data in shift register is 0. now you will give data 1 and give ckl and oe . then delay and then give data 0 and ckl and oe.
 

Exactly the same i am trying to achieve.
If you look at the schematic in my first post.Columns are connected to shift reg 4094 and rows are connected to MCU pins through ULN.

According to your suggestion its working fine for single column shifting. but if i want to shift 2 columns of different values then m not getting the desired output.
I guess i need to refresh the display in fast enough, so that i can see both the columns with different values.

But my question is how to refresh the display. I am thinking to use Timer ISR to perform this. Please help me.
 

when one colum is selected then you should give data for that colum only , then make the data 00 and shift the colum , give the data for that colum .
so you first try to make letters static on the display.
 

Thanks
I did changes according to your suggestions and it partially seems to be working.
But the LED brightness goes down.
According to below values For 1st 10 LEds Middle rows has to glow then for next 10 Leds 1st row has to turn on(to say in simple display should look like Square wave).
But in my case wherever top row has to glow there middle row also glows with low brightness compare to top row.
....... ______.........
_____ .........______

... Low intensity
__ High Intensity
Code:
void scroll() interrupt 1
{

TL0=0xFE; //Reloading Timer0 For static display.
TH0=0xFF;
P1=0x08;
shift_int(1);

 P1=0x01;
shift_int(0);



}

void shift_int(unsigned char temp)
{
unsigned char i;
	clk=0;
	Data=0;
	OE=0;

	for(i=0;i<10;i++)
	{
		clk=0;
		Data=temp;	
		clk=1;
	//	Data=0;
	}
	OE=1;
	clk=0;
	Data=0;
}


void main ()
{
TMOD=0x11; //Intialize Timer 0
TL0=0x00; //Reloading Timer0
TH0=0x00;
IE=0x82; // Enable Timer 0 interrupt
TR0=1; //Start Timer 0
clk=0; 
	Data=0;
	OE=0;
	OE=1;
while(1)
{
;	 
}	
}
 

Its working!!
The problem was called as "Ghost Effect"
Solution:
1.Shift data into Shift reg
2. Turn off ULN outputs.
3. Latch data in Shift reg.
4. Set new ULN output.

Code:
#include<reg51.h>
sbit clk=P2^0; //serial clock pin
sbit Data=P2^1; //serial data pin
sbit OE=P2^2;
sbit OP= P3^7;
int c=0;
int i,j ;
int x,y;
int z;

unsigned char code table3[]={
 0x3E,0x4D,0x53,0x1D,0x1E,0x80,// @
 0x7C,0x12,0x11,0x12,0x7C,0x80,// A
 0x7F,0x49,0x49,0x49,0x36,0x80,// B
 0x3E,0x41,0x41,0x41,0x22,0x80,// C
 0x7F,0x41,0x41,0x22,0x1C,0x80,// D
 0x7F,0x49,0x49,0x49,0x41,0x80,// E
 0x7F,0x09,0x09,0x09,0x01,0x80,// F
 0x3E,0x41,0x49,0x49,0x7A,0x80,// G
 0x7F,0x08,0x08,0x08,0x7F,0x80,// H
 0x80,0x41,0x7F,0x41,0x80,0x80,// I
 0x20,0x40,0x41,0x3F,0x01,0x80,// J
 0x7F,0x08,0x14,0x22,0x41,0x80,// K
 0x7F,0x40,0x40,0x40,0x40,0x80,// L
 0x7F,0x02,0x0C,0x02,0x7F,0x80,// M
 0x7F,0x04,0x08,0x10,0x7F,0x80,// N
 0x3E,0x41,0x41,0x41,0x3E,0x80};// O

 void shift_int(unsigned char temp);
void scroll() interrupt 1
{
TL0=0xFF; //Reloading Timer0
TH0=0xFF;
shift_int(1);

	for(i=0;i<=60;i++)
	{
		P1=table3[i];
		shift_int(0);
	}

}

void shift_int(unsigned char temp)
{
unsigned char i;
	clk=0;
	Data=0;
	OE=0;

	for(i=0;i<1;i++)
	{
		clk=0;
		Data=temp;
		P1=0x00; // To avoid ghosting effect.	
		clk=1;
		//Data=0;
	}
	OE=1;
	clk=0;
	Data=0;
}


void main ()
{
TMOD=0x11; //Intialize Timer 0
TL0=0x00; //Reloading Timer0
TH0=0x00;
IE=0x82; // Enable Timer 0 interrupt
TR0=1; //Start Timer 0
clk=0; 
	Data=0;
	OE=0;
	OE=1;
while(1)
{
;	 
}	
}


Now the next challenge is to Shift the Data from Right to Left.
Please suggest me if have any algorithm for this.
 

Attachments

  • Photo0196.jpg
    Photo0196.jpg
    627.1 KB · Views: 224
A real matrixs display would output text from a data buffer rather than a fixed table. But it's quite easy to rotate the table addresses by an offset that's slowly increased.

I reviewed the schematic given with the initial post and noticed that it's apparently not showing the actual circuit because you can hardly drive LED anodes by an ULN2803. There must be additional PNP transistors or a different driver IC.

I also wonder why the design controls 4094 OE but not STR?
 

Hi guys,

Its working !! Thanks for helping!!
Display is not moving to entire left..
I mean I i m sending "ABC" from right most first 'A" will display the" BC" follows it.. But when it reaches the left most wall(col) as soon as 'A' touches the Left most col entire display would start again.

while(1)
{
k=0;
IE=0x92;
y=0;
Totcol=60; // No of column
temp=0;
do
{
if(over==1)
{
shift_int(1);
for(w=0;w<=Totcol;w++) // Clear the Display by sending 80.
{
P0=0x80;
shift_int(0);
}
Totcol--; // For shifting display one position at a time.
for(x=0;x<cnt;x++)
{
c=table((msg_data[x]&0xf0)>>4);
d=c+(6*(msg_data[x]&0x0f));

for(i=0;i<6;i++) // to read the display data from table
{
P0=*d++;
shift_int(0);
}

}
for(w=0;w<temp;w++) // Again filling space after the msg displayed.
{
P0=0x80;
shift_int(0);
}
temp++;

if(Totcol==-2){ // -2 is for to reach till first col
Totcol=60;

}
DelayMs(20); // tune this according to hardware
over=0;
}

}
while(!NewMessage); // New msg recd flag
for(i=0;i<15;i++)
{
msg_data='\0';
}
IE=0x00;
temp=read_notification();
NewMessage=0;
k=0;

}

}
void scroll() interrupt 1
{
TL0=0x00; //Reloading Timer0
TH0=0xFF;
over=1;
}

void shift_int(bit temp)
{
OE=0;
clk=0;
Data=temp;
P0=0x00;
clk=1;

OE=1;
clk=0;
Data=0;
}


Attached video will explain the problem clearly..
 

Attachments

  • Video0006.zip
    1 MB · Views: 207

But when it reaches the left most wall(col) as soon as 'A' touches the Left most col entire display would start again.
By design of your code, I think. What do you intend else?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top