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.

8x32 LED matrix with 74HC154

Status
Not open for further replies.
to make sure both HC154 don't work at the same time, please try this :

Code:
sbit E1 at P3_0_bit;
sbit E2 at P3_1_bit;

void main() {
unsigned char a;
unsigned char x;
unsigned char y;
unsigned char z;
code unsigned char font[88]=
   {
    //   0     1   2    3     4    5   6    7     8    9    10
        0x3C,0x3C,0x84,0x81,0x10,0x8F,0x60,0x81,0x66,0x46,0x00,
        0x42,0x00,0xC2,0x89,0x18,0x89,0x90,0x41,0x99,0x89,0x00,
        0xA1,0x00,0xA1,0x89,0x14,0x89,0x98,0x21,0x99,0x89,0x00,
        0x91,0xFF,0x91,0x89,0x12,0x89,0x94,0x11,0x99,0x89,0x00,
        0x89,0xFF,0x91,0x89,0x11,0x89,0x92,0x09,0x99,0x89,0x00,
        0x85,0x06,0x91,0x89,0x11,0x89,0x91,0x05,0x99,0x89,0x00,
        0x42,0x04,0x89,0x49,0xFF,0x89,0x90,0x03,0x99,0x89,0x00,
        0x3C,0x00,0x86,0x36,0x10,0x71,0x60,0x01,0x66,0x7E,0x00
    };

unsigned char display [4] = {5,6,7,8};

do
{
  for (z=0;z<100;z++)
  {
    for (x=0;x<2;x++) //2 characters
    {
      for (y=0;y<8;y++ ) //each character contains 8 cols.
      {
        a=(x*8)+y; // 8 cols
        P1=a;
        E1=0;
        E2=1;
        a=(y*11)+display[x];
        P2 = font[a];
        delay_us(500);

      };
    };
  };
  for (z=0;z<100;z++)
  {
    for (x=2;x<4;x++) //2 characters
    {
      for (y=0;y<8;y++ ) //each character contains 8 cols.
      {
        a=(x*8)+y; // 8 cols
        P1=a;
        E1=1;
        E2=0;
        a=(y*11)+display[x];
        P2 = font[a];
        delay_us(500);
      };
    };
  };

} while(1);         // Endless loop
}

It will show :
1st and 2nd character will show 5 and 6 while 3rd and 4th are off.
then after about one second :
3rd and 4th character will show 7 and 8 while 1st and 2nd are off.

and please check the voltage at microcontroller port 3.0 and port3.1. Its should be a pulse.
hey, wait, Port 3.0 and 3.1? You don't use these pins for UART, do you? if you did, please use another pins.

Good idea mate,
Let me have a try.....
May be I will get the luck this time....;)

---------- Post added at 04:11 ---------- Previous post was at 03:21 ----------

to make sure both HC154 don't work at the same time, please try this :

Code:
sbit E1 at P3_0_bit;
sbit E2 at P3_1_bit;

void main() {
unsigned char a;
unsigned char x;
unsigned char y;
unsigned char z;
code unsigned char font[88]=
   {
    //   0     1   2    3     4    5   6    7     8    9    10
        0x3C,0x3C,0x84,0x81,0x10,0x8F,0x60,0x81,0x66,0x46,0x00,
        0x42,0x00,0xC2,0x89,0x18,0x89,0x90,0x41,0x99,0x89,0x00,
        0xA1,0x00,0xA1,0x89,0x14,0x89,0x98,0x21,0x99,0x89,0x00,
        0x91,0xFF,0x91,0x89,0x12,0x89,0x94,0x11,0x99,0x89,0x00,
        0x89,0xFF,0x91,0x89,0x11,0x89,0x92,0x09,0x99,0x89,0x00,
        0x85,0x06,0x91,0x89,0x11,0x89,0x91,0x05,0x99,0x89,0x00,
        0x42,0x04,0x89,0x49,0xFF,0x89,0x90,0x03,0x99,0x89,0x00,
        0x3C,0x00,0x86,0x36,0x10,0x71,0x60,0x01,0x66,0x7E,0x00
    };

unsigned char display [4] = {5,6,7,8};

do
{
  for (z=0;z<100;z++)
  {
    for (x=0;x<2;x++) //2 characters
    {
      for (y=0;y<8;y++ ) //each character contains 8 cols.
      {
        a=(x*8)+y; // 8 cols
        P1=a;
        E1=0;
        E2=1;
        a=(y*11)+display[x];
        P2 = font[a];
        delay_us(500);

      };
    };
  };
  for (z=0;z<100;z++)
  {
    for (x=2;x<4;x++) //2 characters
    {
      for (y=0;y<8;y++ ) //each character contains 8 cols.
      {
        a=(x*8)+y; // 8 cols
        P1=a;
        E1=1;
        E2=0;
        a=(y*11)+display[x];
        P2 = font[a];
        delay_us(500);
      };
    };
  };

} while(1);         // Endless loop
}

It will show :
1st and 2nd character will show 5 and 6 while 3rd and 4th are off.
then after about one second :
3rd and 4th character will show 7 and 8 while 1st and 2nd are off.

and please check the voltage at microcontroller port 3.0 and port3.1. Its should be a pulse.
hey, wait, Port 3.0 and 3.1? You don't use these pins for UART, do you? if you did, please use another pins.

I didn't use P3.0 and P3.1 for UART, it's free, so far I can see in my code....

---------- Post added at 04:12 ---------- Previous post was at 04:11 ----------

to make sure both HC154 don't work at the same time, please try this :

Code:
sbit E1 at P3_0_bit;
sbit E2 at P3_1_bit;

void main() {
unsigned char a;
unsigned char x;
unsigned char y;
unsigned char z;
code unsigned char font[88]=
   {
    //   0     1   2    3     4    5   6    7     8    9    10
        0x3C,0x3C,0x84,0x81,0x10,0x8F,0x60,0x81,0x66,0x46,0x00,
        0x42,0x00,0xC2,0x89,0x18,0x89,0x90,0x41,0x99,0x89,0x00,
        0xA1,0x00,0xA1,0x89,0x14,0x89,0x98,0x21,0x99,0x89,0x00,
        0x91,0xFF,0x91,0x89,0x12,0x89,0x94,0x11,0x99,0x89,0x00,
        0x89,0xFF,0x91,0x89,0x11,0x89,0x92,0x09,0x99,0x89,0x00,
        0x85,0x06,0x91,0x89,0x11,0x89,0x91,0x05,0x99,0x89,0x00,
        0x42,0x04,0x89,0x49,0xFF,0x89,0x90,0x03,0x99,0x89,0x00,
        0x3C,0x00,0x86,0x36,0x10,0x71,0x60,0x01,0x66,0x7E,0x00
    };

unsigned char display [4] = {5,6,7,8};

do
{
  for (z=0;z<100;z++)
  {
    for (x=0;x<2;x++) //2 characters
    {
      for (y=0;y<8;y++ ) //each character contains 8 cols.
      {
        a=(x*8)+y; // 8 cols
        P1=a;
        E1=0;
        E2=1;
        a=(y*11)+display[x];
        P2 = font[a];
        delay_us(500);

      };
    };
  };
  for (z=0;z<100;z++)
  {
    for (x=2;x<4;x++) //2 characters
    {
      for (y=0;y<8;y++ ) //each character contains 8 cols.
      {
        a=(x*8)+y; // 8 cols
        P1=a;
        E1=1;
        E2=0;
        a=(y*11)+display[x];
        P2 = font[a];
        delay_us(500);
      };
    };
  };

} while(1);         // Endless loop
}

It will show :
1st and 2nd character will show 5 and 6 while 3rd and 4th are off.
then after about one second :
3rd and 4th character will show 7 and 8 while 1st and 2nd are off.

and please check the voltage at microcontroller port 3.0 and port3.1. Its should be a pulse.
hey, wait, Port 3.0 and 3.1? You don't use these pins for UART, do you? if you did, please use another pins.

May be just change P3.0 and P3.1 to P3.2 and P3.3, but I don't think it will help....

---------- Post added at 05:46 ---------- Previous post was at 04:12 ----------

Mate,

It's not 5 6 7 8 but 5 6 and strange characters,
you can see on the video
 

With program at post #60, Have you measured voltage at pin 19 of both HC154's? if it is too fast, you can change the line 26 and 43 with greater. It must toggle 0 to 5 V, if it less than 5V, you need add strong pull-up or maybe your HC154 is damage, replace with a new one, or check all cable connection. After all, i have no idea.
 

With program at post #60, Have you measured voltage at pin 19 of both HC154's? if it is too fast, you can change the line 26 and 43 with greater. It must toggle 0 to 5 V, if it less than 5V, you need add strong pull-up or maybe your HC154 is damage, replace with a new one, or check all cable connection. After all, i have no idea.

OK, I will try
 

With program at post #60, Have you measured voltage at pin 19 of both HC154's? if it is too fast, you can change the line 26 and 43 with greater. It must toggle 0 to 5 V, if it less than 5V, you need add strong pull-up or maybe your HC154 is damage, replace with a new one, or check all cable connection. After all, i have no idea.

you mean, I increase
Code:
for (z=0;z<100;z++)
with a greater value ?

---------- Post added at 02:47 ---------- Previous post was at 02:04 ----------

After I rechecked the connection, I've found out that I put the wrong pins for E1 and E2, that's why it's strange,
Please have a look 5 6 7 8 on the video, it's 1us delay, how can I make it stable, it's the fastest delay I can get...
 

With program at post #60, Have you measured voltage at pin 19 of both HC154's? if it is too fast, you can change the line 26 and 43 with greater. It must toggle 0 to 5 V, if it less than 5V, you need add strong pull-up or maybe your HC154 is damage, replace with a new one, or check all cable connection. After all, i have no idea.

Can I make function like this :

Code:
void main()
 {
    display_character(1,2,3,4);
    display_character(5,6,7,8);
 }

and the character is passed into
unsigned char display [4] = {c,d,e,f};

where c,d,e,f will be filled with 1,2,3,4 then 5,6,7,8.....

---------- Post added at 06:20 ---------- Previous post was at 06:14 ----------

Code:
void display_character (char j,k,l,m)
{
   unsigned char display [4] = {j,k,l,m};
.
.
.
.
}

void main()
 {
   while(1)
       {
	  display_character(1,2,3,4);
          delay_ms(100);
          display_character(5,6,7,8);
	}
 }

I get error :

32_8_MAIN.C(48): error C247: non-address/-constant initializer
 

I created 1 2 3 4, actually want to continue to 5 6 7 8 but haven't got idea on changing the array
1234.jpg
 

I tried to build
Code:
 void display_character (char j,k,l,m)  {
unsigned char x,y,a,z;

unsigned char display [4]; // we can modify value of this variable in run time
				
					display[0]=j;
					display[1]=k;
					display[2]=l;
					display[3]=m; 
.
.
.
.
.

          display_character(1,2,3,4);
	  delay_100(5000000);
	  display_character(5,6,7,8);

but the character is blinking between 1 2 3 4 and 5 6 7 8.....where should I put the delay ?
 

I tried to build
Code:
 void display_character (char j,k,l,m)  {
unsigned char x,y,a,z;

unsigned char display [4]; // we can modify value of this variable in run time
				
					display[0]=j;
					display[1]=k;
					display[2]=l;
					display[3]=m; 
.
.
.
.
.

          display_character(1,2,3,4);
	  delay_100(5000000);
	  display_character(5,6,7,8);

but the character is blinking between 1 2 3 4 and 5 6 7 8.....where should I put the delay ?

How to show a blank character to clear a display ?

---------- Post added at 23:52 ---------- Previous post was at 23:48 ----------

May be like this :
Code:
 display_character(0,1,2,3);
	  delay_100(500000);
	  display_character(10,10,10,10);//blank
	  delay_100(5000000);
	  display_character(4,5,6,7);
	  delay_100(500000);
	  display_character(10,10,10,10);//blank
	  delay_100(5000000);
 

I created shifting characters

If I want to create 64x8 or 128x8, the code is the same, isn't it ?
 

I tried to make A to Z, but why there're some noise in a characters,
Please see the video :
Code:
code unsigned char font[296]=
   {
    //   0     1   2    3     4    5   6    7     8    9  Blank H   E    L     O    A    B    C   D     F   G     I    J    K    M    N    P    Q    R    S    T    U    V    W    X    Y    Z   
        0x3C,0x84,0x84,0x42,0x10,0x8F,0x60,0x81,0x66,0x06,  0x00,0xFF,0x81,0x81,0x3C,0xFC,0x81,0x3C,0xC1,0x81,  0x1C,0x81,0x60,0x81,0xFF,0xFF,0x81,0x3E,0x81,0x46,  0x03,0xFF,0x3F,0xFF,0xC3,0x07,0x87,
        0x42,0x82,0xC2,0x81,0x18,0x89,0x90,0x41,0x99,0x09,  0x00,0x08,0xFF,0xFF,0x42,0x12,0xFF,0x42,0xFF,0xFF,  0x62,0x81,0x80,0xFF,0x01,0x01,0xFF,0x41,0xFF,0xC9,  0x01,0x80,0x40,0x80,0x24,0x88,0xE1,
        0xA1,0x81,0xA1,0x89,0x14,0x89,0x98,0x21,0x99,0x89,  0x00,0x08,0x89,0x81,0xC3,0x11,0x89,0xC3,0x81,0x89,  0x43,0xFF,0x80,0x89,0x06,0x02,0x89,0x41,0xFF,0x89,  0x81,0x80,0x80,0x60,0x24,0x88,0x91,
        0x91,0xFF,0x91,0x89,0x12,0x89,0x94,0x11,0x99,0x89,  0x00,0x08,0x89,0x81,0x81,0x11,0x89,0x81,0x81,0x89,  0xC1,0x81,0x81,0x08,0x18,0x04,0x89,0x41,0x09,0x99,  0xFF,0x80,0x80,0x30,0x18,0xF8,0x89,
        0x89,0xFF,0x91,0x89,0x11,0x89,0x92,0x09,0x99,0x89,  0x00,0x08,0x9D,0x80,0xC3,0x11,0x89,0x81,0xC3,0x1D,  0x91,0x81,0x81,0x1C,0x06,0x08,0x09,0xC1,0x19,0x93,  0x81,0x80,0x40,0x60,0x24,0x88,0x85,
        0x85,0x80,0x91,0x99,0x11,0x89,0x91,0x05,0x99,0x49,  0x00,0xFF,0x81,0x80,0x42,0x12,0xC9,0x81,0x62,0x01,  0x93,0x00,0x7F,0x14,0x01,0x10,0x09,0xBE,0xFF,0x72,  0x03,0xFF,0x3F,0x80,0x24,0x07,0x83,
        0x42,0x80,0x89,0x56,0xFF,0x89,0x90,0x03,0x99,0x49,  0x00,0x00,0xE3,0xE0,0x3C,0xFC,0x36,0x62,0x1C,0x03,  0xF2,0x00,0x01,0xE3,0xFF,0xFF,0x06,0x00,0xC6,0x00,  0x00,0x00,0x00,0xFF,0xC3,0x00,0xE1,
        0x3C,0x80,0x86,0x24,0x10,0x71,0x60,0x01,0x66,0x3E,  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    };  

 for (y=0;y<8;y++ ) //each character contains 8 cols.
		      {
		        a=(x*8)+y; // 8 cols
		        P1=a;
		        E1=0;
		        E2=1;
		        a=(y*37)+display[x]; // 37 = the amount of font
		        P2 = ~font[a];
		        delay_100(1);
		
		      };

What should I do to fix ?

Thanks
 

Any ideas, on how to change the character behaviour from PC serial communication ?
Thanks
 

I'm sorry, i was too busy lately. Please upload your latest complete program and what's the problem now?
I tried to make A to Z, but why there're some noise in a characters,

you can see at the video above, if I reduce the characters to 30, there's no noise..

---------- Post added at 04:03 ---------- Previous post was at 04:00 ----------

I'm sorry, i was too busy lately. Please upload your latest complete program and what's the problem now?
do you have idea on how to change the character displayed via PC ( serial communication )?
I create software in PC which will update the character behaviour on those matrix 32x8 ?

---------- Post added at 04:07 ---------- Previous post was at 04:03 ----------

Code:
void display_character (char j,k,l,m)  {
unsigned char x,y,a,z;

unsigned char display [4]; // we can modify value of this variable in run time
				
					display[0]=j;
					display[1]=k;
					display[2]=l;
					display[3]=m; 
				 
//while(1)	//Loop without stopping
//	{
		for (z=0;z<5;z++)
		  {
		    for (x=0;x<2;x++) //2 characters
		    {
		      for (y=0;y<8;y++ ) //each character contains 8 cols.
		      {
		        a=(x*8)+y; // 8 cols
		        P1=a;
		        E1=0;
		        E2=1;
		        a=(y*37)+display[x]; // 37 = the amount of font
		        P2 = ~font[a];
		        delay_100(1);
		
		      };
		    };
		  };
		  for (z=0;z<5;z++)
		  {
		    for (x=2;x<4;x++) //2 characters
		    {
		      for (y=0;y<8;y++ ) //each character contains 8 cols.
		      {
		        a=(x*8)+y; // 8 cols
		        P1=a;
		        E1=1;
		        E2=0;
		        a=(y*37)+display[x]; // 37 = the amount of font
		        P2 = ~font[a];
		        delay_100(1);
		      };
		    };
		  };
		  //delay_100(200);
//		}//end of while
	}//end of display_char

void display_clear()
{
  unsigned int i;
	 for (i=1;i<2e0;i++)
	  {
	    display_character(10,10,10,10);//blank
      }
	  
}

void display_character_pattern(unsigned char a,b,c,d)
{
  unsigned int i;
	 for (i=1;i<2e2;i++)
	  {
	    display_character(a,b,c,d);//blank
      }
	  
}
void display_numeric_test()
 {
      display_character_pattern(0,1,2,3);
	  display_clear();
	  display_character_pattern(4,5,6,7);
	  display_clear();
	  display_character_pattern(8,9,10,10);
	  display_clear();
 }
 

Ok. I will check it.
Thanks my friend, it's strange, if I reduce the character quantity, the noise will go away, but if I put 37 characters, the noise is back and some shadow matrix appeared..

---------- Post added at 04:46 ---------- Previous post was at 04:43 ----------

Code:
code unsigned char font[296]=
   {
    //   0     1   2    3     4    5   6    7     8    9  Blank H   E    L     O    A    B    C   D     F   G     I    J    K    M    N    P    Q    R    S    T    U    V    W    X    Y    Z   
        0x3C,0x84,0x84,0x42,0x10,0x8F,0x60,0x81,0x66,0x06,0x00,0xFF,0x81,0x81,0x3C,0xFC,0x81,0x3C,0xC1,0x81,0x1C,0x81,0x60,0x81,0xFF,0xFF,0x81,0x3E,0x81,0x46,0x03,0xFF,0x3F,0xFF,0xC3,0x07,0x87,
        0x42,0x82,0xC2,0x81,0x18,0x89,0x90,0x41,0x99,0x09,0x00,0x08,0xFF,0xFF,0x42,0x12,0xFF,0x42,0xFF,0xFF,0x62,0x81,0x80,0xFF,0x01,0x01,0xFF,0x41,0xFF,0xC9,0x01,0x80,0x40,0x80,0x24,0x88,0xE1,
        0xA1,0x81,0xA1,0x89,0x14,0x89,0x98,0x21,0x99,0x89,0x00,0x08,0x89,0x81,0xC3,0x11,0x89,0xC3,0x81,0x89,0x43,0xFF,0x80,0x89,0x06,0x02,0x89,0x41,0xFF,0x89,0x81,0x80,0x80,0x60,0x24,0x88,0x91,
        0x91,0xFF,0x91,0x89,0x12,0x89,0x94,0x11,0x99,0x89,0x00,0x08,0x89,0x81,0x81,0x11,0x89,0x81,0x81,0x89,0xC1,0x81,0x81,0x08,0x18,0x04,0x89,0x41,0x09,0x99,0xFF,0x80,0x80,0x30,0x18,0xF8,0x89,
        0x89,0xFF,0x91,0x89,0x11,0x89,0x92,0x09,0x99,0x89,0x00,0x08,0x9D,0x80,0xC3,0x11,0x89,0x81,0xC3,0x1D,0x91,0x81,0x81,0x1C,0x06,0x08,0x09,0xC1,0x19,0x93,0x81,0x80,0x40,0x60,0x24,0x88,0x85,
        0x85,0x80,0x91,0x99,0x11,0x89,0x91,0x05,0x99,0x49,0x00,0xFF,0x81,0x80,0x42,0x12,0xC9,0x81,0x62,0x01,0x93,0x00,0x7F,0x14,0x01,0x10,0x09,0xBE,0xFF,0x72,0x03,0xFF,0x3F,0x80,0x24,0x07,0x83,
        0x42,0x80,0x89,0x56,0xFF,0x89,0x90,0x03,0x99,0x49,0x00,0x00,0xE3,0xE0,0x3C,0xFC,0x36,0x62,0x1C,0x03,0xF2,0x00,0x01,0xE3,0xFF,0xFF,0x06,0x00,0xC6,0x00,0x00,0x00,0x00,0xFF,0xC3,0x00,0xE1,
        0x3C,0x80,0x86,0x24,0x10,0x71,0x60,0x01,0x66,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    };
 

At procedure : display_character, variable a is char type, change it to integer, so it won't be overflow.

I change it :
Code:
void display_character (int j,k,l,m)  {
unsigned int x,y,a,z;


unsigned int display [4]; // we can modify value of this variable in run time
				
					display[0]=j;
					display[1]=k;
					display[2]=l;
					display[3]=m;


---------- Post added at 12:59 ---------- Previous post was at 12:43 ----------

At procedure : display_character, variable a is char type, change it to integer, so it won't be overflow.
It's better my friend, but I still saw a shadow in some characters, I will record the video,
do you know why ?
 

At procedure : display_character, variable a is char type, change it to integer, so it won't be overflow.
I can send a character via PC to the matrix, but I have another idea, how do display per character then shift to the left,
for example, I send 'A', the matrix will be A on the 4th character so : X X X A, then I send B, microcontroller will shift A to the left and display X X A B, then I send C from PC, and the display will be X A B C, then I send D, the display will be A B C D, do you have idea ?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top