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.

[51] 8*8 matrix with 8051 and shift register 74hc595

Status
Not open for further replies.

Development

Newbie level 2
Joined
Jan 28, 2019
Messages
2
Helped
0
Reputation
0
Reaction score
1
Trophy points
1
Activity points
29
Hello All,

I am using 8051 and shift register for led matrix scrolling, at start I want scroll two characters in 8*8 matrix.

However, I could not manage the gap between these characters, My one character scroll complete and then second character start...

And if i put both characters in single array, they get overlap...

Could anyone help me for the solution...

Below is my code and attach is circuit diagram for the same.



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#include <reg51.h>
 
char row[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
 
char colp[8]={0x00,0x0f,0x09,0x09,0x0f,0x08,0x08,0x00}; // to print P
char cola[8]={0x00,0x06,0x09,0x09,0x0f,0x09,0x09,0x00}; // to print A
 
sbit SH_CP = P2^0;
sbit DS = P2^1;
sbit ST_CP = P2^2;
 
void delay_us(unsigned int us_count);
void pulse(char pin);
void SIPO(unsigned char byte);
void init(void);
 
void delay_us(unsigned int us_count)
 {  
   us_count = us_count;   
     while(us_count!=0)
      {
         us_count--;
       }
}
 
void pulse(char pin)
{
    if(pin=='S')
    {
     SH_CP=0;
     delay_us(1);
     SH_CP= 1;
    }
    else if(pin=='R')
     {
        ST_CP=1;
      delay_us(1);
      ST_CP= 0;
     }
}
 
void SIPO(unsigned int byte)
 {
  unsigned int Mask = 0x0001, t, Flag;
   for (t=0; t<12; t++)
     {
      Flag = byte & Mask;
            if(Flag==0)
                {
                  DS = 0;
                }   else 
                {
                DS = 1;
                }
  SH_CP = 1;
  SH_CP = 0;
  Mask = Mask << 1;
 }
 
 ST_CP = 1;
 ST_CP = 0;
}
 
 
void init(void){
  DS=0;
    SH_CP=0;
    ST_CP=0;
}
 
 
void delay(unsigned int a)
{
 unsigned int i,j;
 for(i=0;i<a;i++)
 for(j=0;j<1000;j++);
}
 
 
void main()
 {
     unsigned int i=0,j,k=0,l,x,y,z=0,u,a=0;
     P2=0x00;
     P3=0x00;
     init();
            while(1)
                {
                    a=0;
                for(l=0;l<12;l++)
                    {
                      for(j=0;j<24;j++)
                        { 
                            for(k=0;k<8;k++)
                 {
                                    if(i==8)
                                        {
                                            i=0;
                                    }
                                    P3=row[i];  // column
                                //SIPO(0x01<<l);
                                    SIPO(cola[k]<<l);
                                    pulse('R');    // row  
                                    //delay(1); 
                                        SIPO(0x00);
                                    pulse('R');    // row  
                                    //  delay(1);
                                    i++;
                                    }
                                 delay(1);
                                }
                            
                                if(a==0)
                                    {
                                    for(u=0; u<12; u++){
                                for(x=0;x<24;x++)
                        { 
                            for(y=0;y<8;y++)
                 {
                                    if(z==8)
                                        {z=0;
                                    }
                                    P3=row[z];  // column
                                //SIPO(0x01<<l);
                                    SIPO(colp[y]<<u);
                                    pulse('R');    // row  
                                    //delay(1); 
                                        SIPO(0x00);
                                    pulse('R');    // row  
                                    //  delay(1);
                                        
                                    z++;
                                    }
                                 delay(1);
                                }
                            
                            }   
                                }   
                                a++;        
                         }
                     
          }
 }

 

Attachments

  • Circuit Diagram.JPG
    Circuit Diagram.JPG
    156.5 KB · Views: 115
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top