4158 views|30 replies

39

Posts

0

Resources
The OP
 

I use a 1588bs dot matrix, and the results are always different from the ideal [Copy link]

 

I am using a 1588bs dot matrix, and then I saw the pin diagram. If I want all 64 dots to light up, then is the program code for my setting oxcb 0x29? This is the code. If it is not a code problem, then what is the problem?

If it is a PCB board connection problem, I don't know how to upload the ad software. . . Please help me find out

#include<reg51.h>
#include<intrins.h>
sbit SRCLK=P3^6;
sbit RCLK=P3^5;
sbit SER=P3^4;

#define hang P0

void ys()

{
unsigned char q,w,e,r;

for(q=5;q>0;q--)

for(w=4;w>0;w--)

for(e=116;e>0;e--)

for(r=214;r>0;r--);

}


void Hc595SendByte(unsigned char dat)
{
unsigned char a;
SRCLK=0;
RCLK=0;
for(a=0;a<8;a++)
{
SER=dat>>7;
dat<<=1;

SRCLK=1;
_nop_();
_nop_();
SRCLK=0;
}

RCLK=1;
_nop_();
_nop_();
RCLK=0;
}

void xs(unsigned int o)
{
unsigned char j;

unsigned int p=1;
unsigned int k;


for(k=0;k<o;k++) //Changing the value can change the non-displayed time
{
ys();
}
while(p)
{


hang = 0xcb;
Hc595SendByte(0x29);



}
j++;
if(j == 8)
{
j = 0;
}
p++;
if(p == 1000) //Modifying the value can change the display duration
{
p = 0;
}

}


void main()
{

while(1)
{
xs(1);

}
}

This post is from 51mcu

Latest reply

Try adding pull-up to the stc P0 port.   Details Published on 2021-4-13 08:49
 

693

Posts

7

Resources
2
 

When posting, there is a file upload icon that can be used to send files.

This post is from 51mcu
 
 
 

39

Posts

0

Resources
3
 

There are PCB and schematic diagrams in it. You don't need to look at the two-stage light-emitting tube. Just look at the dot matrix part. Thank you~

AD.rar

1.04 MB, downloads: 4

This post is from 51mcu
 
 
 

6062

Posts

4

Resources
4
 
This post was last edited by damiaa on 2021-4-6 15:48

1st column 2nd column 3rd column 4th column 5th column 6th column 7th column 8th column
13 3 4 10 6 11 15 16
Q4 P02 P03 Q1 P05 Q2 Q6 Q7
1st row 9 Q0
2nd row 14 Q5
3rd row 8 P07
4th row 12 Q3
5th row 1 P00
6th row 7 P06
7th row 2 P01
8th row 5 P04
From the above figure, we know that the control IO correspondence is as above. So programming is very troublesome. The best thing is to make all P0 rows or all columns.

Without changing the version, first calculate which IOs are high and which are low for your 8*8 dot matrix, then calculate the data to be sent by 595 and the data to be sent by P0, and then send them together. This will make scanning much slower.

But that's okay. Eyes are slow but CPUs are fast.

This post is from 51mcu
 
 
 

6062

Posts

4

Resources
5
 

If you just want to light up all of them, you need to ensure that all rows are at high levels and all columns are at low levels.

595 means to send 0x00101001 = 0x29

P0 sends 0x11010011 =0xd3

Try it.

This post is from 51mcu

Comments

Only three rows are lit. . . .  Details Published on 2021-4-6 18:11
 
 
 

2w

Posts

341

Resources
6
 

There is nothing wrong with the schematic

This post is from 51mcu

Comments

Hello, can you help me look at the PCB again, because I will also change the package later, and I will directly change the PCB diagram later, thank you very much! You don't need to look at the LEDs, there should be no problem with them.  Details Published on 2021-4-6 18:12
 
 
 

6062

Posts

4

Resources
7
 
This post was last edited by damiaa on 2021-4-6 16:54
//类似这样修改 看看如何 如果不对自己修改一下。
unsigned char Led_S[8]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};//想要改变点亮数据就改这里然后调用LedFlash
void Line_To_Send(unsigned char x,unsigned char led)
{
   unsigned char i,H595_val=0,P0_val=0; 
   switch(x)
   {
   	case 1:    H595_val |=0x1;  break;//Q0
    case 2:    H595_val |=0x20; break;//Q5
    case 3:    P0_val   |=0x80; break;//P07
   	case 4:    H595_val |=0x08; break;//Q3
   	case 5:    P0_val   |=0x1;  break;//P00
   	case 6:    P0_val   |=0x40; break;//P06
   	case 7:    P0_val   |=0x2;  break;//P01
   	case 8:    P0_val   |=0x10; break;//P04
   } 
   for(i=0;i<8;i++)  
   {
      unsigned val=led&(1<<i);  
      if(val)
      {
       	switch(val)
	{
		case 1<<0:    H595_val |=0x10; break;  //Q4
    case 1<<1:    P0_val   |=0x04;  break;  //P02 
    case 1<<2:    P0_val   |=0x08;  break;  //P03 
    case 1<<3:    H595_val |=0x02; break;  //Q1 
    case 1<<4:    P0_val   |=0x20;  break;  //P05  
    case 1<<5:    H595_val |=0x04; break;  // Q2  
    case 1<<6:    H595_val |=0x40; break;  // Q6 
    case 1<<7:    H595_val |=0x80; break;  // Q7
	}
      } 
   }
   P0 =0;
   Hc595SendByte(0);//这个函数自己实现
   P0=P0_val;
   Hc595SendByte(H595_val);//
   
} 
void LedFlash(unsigned char *pLeds)
{
	unsigned char i;
  for(i=0;i<8;i++)
	{
         	Line_To_Send(i+1,*(pLeds+i));
	}
       
}
void delayms(unsigned int x)//这个函数自己实现
{
}
void main(void)
{
	while(1)
	{
		LedFlash(&Led_S[0]);
        delayms(10); 
	}
}

This post is from 51mcu

Comments

12.c(34): error C202: 'P0': undefined identifier Hello, there is an error in the compilation. Shouldn't po not be defined? . . .  Details Published on 2021-4-7 08:28
12.c(34): error C202: 'P0': undefined identifier Hello, there is an error in the compilation. Shouldn't po not be defined? . . .  Details Published on 2021-4-6 18:18
 
 
 

39

Posts

0

Resources
8
 
damiaa posted on 2021-4-6 15:20 If you just want to light up all the lines, you have to make sure that all the rows are high and all the columns are low. 595 means to send 0x00101001 =0x29 P0& ...

Only three rows are lit. . . .

This post is from 51mcu
 
 
 

39

Posts

0

Resources
9
 
qwqwqw2088 posted on 2021-4-6 16:10 There is nothing wrong with the schematic diagram

Hello, can you help me look at the PCB again, because I will also change the package later, and I will directly change the PCB diagram later, thank you very much! You don't need to look at the LEDs, there should be no problem with them.

This post is from 51mcu

Comments

[attachimg]531856[/attachimg][attachimg]531857[/attachimg] The layout of the LED matrix and 595 is not very reasonable, but it does not affect the lighting. It should be the program. Check it carefully.  Details Published on 2021-4-6 21:17
 
 
 

39

Posts

0

Resources
10
 
damiaa posted on 2021-4-6 16:49 // Modify it like this to see how it works. If you don't modify it yourself, unsigned char Led_S[8]={0xff,0xff,0xff,0xff,0xff,0 ...

12.c(34): error C202: 'P0': undefined identifier

Hello, there is an error in the compilation. Doesn't po need to be defined? . .

This post is from 51mcu
 
 
 

2w

Posts

341

Resources
11
 
Demonstration method published on 2021-4-6 18:12 Hello, can you help me look at the PCB again, because I am also changing the package later, and I will directly change the PCB diagram later. Thank you very much! You don’t need to look at the light-emitting diode, ...

The layout of the LED dot matrix and 595, including the wiring, is not very reasonable, but it does not affect the lighting.

It should be about the program. Check it carefully.

This post is from 51mcu

Comments

So, what is the problem? The program can be simulated in Proteus. The side with words on the dot matrix is from left to right 1-9.  Details Published on 2021-4-6 22:43
 
 
 

39

Posts

0

Resources
12
 
qwqwqw2088 posted on 2021-4-6 21:17 Demonstration method posted on 2021-4-6 18:12 Hello, can you help me take another look at the pcb, because I am also changing the package later, and the pcb diagram will be directly changed later...

So, what is the problem? The program can be simulated in Proteus. The side with words on the dot matrix is from left to right 1-9.

This post is from 51mcu
 
 
 

6062

Posts

4

Resources
13
 
damiaa posted on 2021-4-6 16:49 // Modify it like this to see how it works. If you don't modify it yourself, unsigned char Led_S[8]={0xff,0xff,0xff,0xff,0xff,0 ...

51 header files include it.

This post is from 51mcu
 
 
 

6062

Posts

4

Resources
14
 

Also, is leg 1 of your LED matrix consistent with the schematic diagram?

This post is from 51mcu

Comments

The side with words on it is from left to right 1-9. The leftmost one is leg 1.  Details Published on 2021-4-7 10:51
 
 
 

6062

Posts

4

Resources
15
 

1st row 2nd row 3rd row 4th row 5th row 6th row 7th row 8th row
13 3 4 10 6 11 15 16
Q4 P02 P03 Q1 P05 Q2 Q6 Q7
1st row 9 Q0
2nd row 14 Q5
3rd row 8 P07
4th row 12 Q3
5th row 1 P00
6th row 7 P06
7th row 2 P01
8th row 5 P04

Do an experiment, connect the legs 9, 14, 8, 12, 1, 7, 2, 5 of the upper row to the power supply, and connect the others to a resistor and then to the ground. See how many rows light up.

This post is from 51mcu
 
 
 

6062

Posts

4

Resources
16
 

Or you can get a small flat battery and tap it. You can add a resistor in the middle. Test one by one.

9-leg positive --- + battery -- resistor -- ---- 13-leg

9-leg positive --- + battery -- resistor -- ---- 3-leg

9-leg positive --- + battery -- resistor -- ---- 4-leg

. . .

Just try to figure it out, and you'll know which is the row and which is the column, which is positive and which is negative.

It is really hard to let people guess what you have in your hand. What if your dot matrix model or pinout is wrong? No matter how people guess, it will be useless.

The program is just a reference for you. You need to modify it according to the specific situation.

This post is from 51mcu

Comments

Okay, thank you very much.  Details Published on 2021-4-7 09:52
 
 
 

39

Posts

0

Resources
17
 
damiaa posted on 2021-4-7 08:43 Or you can get a small flat battery and click it. You can add a resistor in the middle. Test one by one. 9 legs positive --- + &nbs ...

Okay, thank you very much.

This post is from 51mcu
 
 
 

39

Posts

0

Resources
18
 
damiaa posted on 2021-4-7 08:29 Also, is the 1st leg of your LED matrix consistent with the schematic diagram?

The side with words on it is from left to right 1-9. The leftmost one is leg 1.

This post is from 51mcu

Comments

Take down the dot matrix screen and try it. Test it as above. It won't have any effect if you connect it wrong. Try it boldly.  Details Published on 2021-4-7 16:27
 
 
 

6062

Posts

4

Resources
19
 
The demonstration method was published on 2021-4-7 10:51 The side with words on it is from left to right 1-9. The one on the far left is leg 1

Take down the dot matrix screen and try it. Test it as above. It won't have any effect if you connect it wrong. Try it boldly.

This post is from 51mcu

Comments

The board matrix has been soldered. Then I didn't connect the resistor in series this afternoon, and it seems that the matrix is broken. I'm going to try another brand of matrix. Then I'll solder one side again. If it still doesn't work, I'll use a multimeter to test it.  Details Published on 2021-4-7 17:10
The board matrix has been soldered. Then I didn't connect the resistor in series this afternoon, and it seems that the matrix is broken. I'm going to try another brand of matrix. Then I'll solder one side again. If it still doesn't work, I'll use a multimeter to test it.  Details Published on 2021-4-7 17:10
 
 
 

39

Posts

0

Resources
20
 
damiaa posted on 2021-4-7 16:27 Take off the dot matrix screen and try it. Test it according to the above method. There is no effect if you connect it wrong. Be bold and try it.

The board matrix has been soldered. Then I didn't connect the resistor in series this afternoon, and it seems that the matrix is broken . I'm going to try another brand of matrix. Then I'll solder one side again. If it still doesn't work, I'll use a multimeter to test it.

This post is from 51mcu

Comments

In this case, it is most convenient to use a multimeter to measure  Details Published on 2021-4-8 16:35
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list