[SOLVED] 8x10 LED MATRIX VERTICAL SCANNING WORKING BUT HOW TO CONTROL SPEED ?

Status
Not open for further replies.

vijaynallasivam

Junior Member level 1
Joined
Nov 16, 2015
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
150
Anybody know how to control speed ?
It is very fast.


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
#include<pic.h>
#include <delay4.c>
 
#define _XTAL_FREQ 20e6
__CONFIG(0x3F3A);
 
char z,i;                          
void pattern(char a,char b,char c,char d,char e,char f,char g,char h,char n)
   {
     for(z=0;z<9;z++)   
       {
    for(i=0;i<10;i++)  
          {
          PORTD=a;DelayMs(100);RB6=1;RB6=0;
          PORTD=b;DelayMs(100);RB6=1;RB6=0;
          PORTD=c;DelayMs(100);RB6=1;RB6=0;
          PORTD=d;DelayMs(100);RB6=1;RB6=0;
          PORTD=e;DelayMs(100);RB6=1;RB6=0;
          PORTD=f;DelayMs(100);RB6=1;RB6=0;
          PORTD=g;DelayMs(100);RB6=1;RB6=0;
          PORTD=h;DelayMs(100);RB6=1;RB6=0;
          PORTD=n;DelayMs(100);RB6=1;RB6=0;
          }
      (a=a<<1);
      (b=b<<1);
      (c=c<<1);
      (d=d<<1);
      (e=e<<1);
      (f=f<<1);
      (g=g<<1);
      (h=h<<1);
      (n=n<<1);
      }
   }
 
/////////////////////////////////////////
void main()
{   
    TRISA=0x00;
    TRISD=0x00;
    TRISB=0x00;
    TRISC=0x00;
    TRISE=0x00;
 
    PORTD = 0x00;
    PORTB = 0x00;
    PORTC = 0x00;
    PORTE = 0x00;
    RB7=1;
    RB7=0;
    while(1)
     {
     pattern(0xFF, 0x80, 0x80, 0x80, 0xFF, 0x01, 0x01, 0x01, 0xFF); //LETTER S
    }
}

 
Last edited by a moderator:

The intuitive question:
Why not insert dalay at the loop function on the main() ?
 

main loop i am using delay but display dot dot dot go ......
 

Not clear, you need depict few more elaborated the the problem.
 

i am using pic16f877a controller mplab hitech c compiler .this program was working fast and i am using for(s=0;still<100;s++)loop for main function .the scanning row is same speed dot dot dot one by one its go.this program taken by net.


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
#include <htc.h>
#define _XTAL_FREQ 4e6 // 4MHz 
__CONFIG(0x3FFA);
void delay(unsigned int k)
{for(int i=0;i<=k;i++)}
void pattern(unsigned int a,b,c,d,e,f,g,h,i,j)
{ 
for(int z=0;z<9;z++)
{   for(int z=0;z<10;z++)
{
PORTB=a;delay(100);RA0=1;RA0=0;
PORTB=b;delay(100);RA0=1;RA0=0;
PORTB=c;delay(100);RA0=1;RA0=0;
PORTB=d;delay(100);RA0=1;RA0=0;
PORTB=e;delay(100);RA0=1;RA0=0;
PORTB=f;delay(100);RA0=1;RA0=0;
PORTB=g;delay(100);RA0=1;RA0=0;
PORTB=h;delay(100);RA0=1;RA0=0;
PORTB=i;delay(100);RA0=1;RA0=0;
PORTB=j;delay(100);RA0=1;RA0=0;
}
(a=a<<1);
(b=b<<1);
(c=c<<1);
(d=d<<1);
(e=e<<1);
(f=f<<1);
(g=g<<1);
(h=h<<1);
(i=i<<1);
(j=j<<1);
 
}
}
void main()
{
TRISB=0;TRISA=11100;PORTA=0;PORTA=2;PORTA=1;PORTA= 0;
while(1)
{
pattern(28,20,54,34,99,127,127,99,65,65); //LETTER A
pattern(124,102,99,99,126,126,99,99,102,124); //LETTER B
pattern(62,127,99,96,96,96,96,99,127,62); //LETTER C
pattern(124,126,103,99,99,99,99,103,126,124); //LETTER D
pattern(127,127,96,96,124,124,96,96,127,127); //LETTER E
 
}
 
}

some alter to use this program .i want 10x8 matrix vertical scrolling and left to right scrolling hitech c compiler program
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…