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.

8X8 dot matrix LED display

Status
Not open for further replies.

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
899
Helped
24
Reputation
48
Reaction score
26
Trophy points
1,318
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,252
Need an example code for 8X8 Dot Matrix LED display in microC.

Basically I was trying to make one. I tried in many ways but it doesn't work. I don't know what was wrong I was doing....

here is my file:


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
const unsigned short letters[16] =
 {
 
    0x18,0x3C,0x66,0x66,0x7E,0x7E,0x66,0x66,   //A
    0xFF, 0x00, 0x76, 0x76, 0x76, 0x89, 0xFF, 0xFF   //B
 };
 
 
unsigned short column, num, repeat, count;
void main()    // Programme principal
{
 
 TRISD = 0x00;//all output
 TRISC = 0x00;//all output
 
 while(1)                            // Boucle infinie
 {
       for (num=0;num<2;num++)
       {
          for (repeat=0; repeat<20; repeat++)
          {
               column = 1;
               for (count = num*8;count < (num*8+8);count++)
               {
                   PORTD = letters[count];
                   PORTC = column;
                   column = column<<1;
                   delay_ms(1);
               }
          }
          Delay_ms(1000);
        }
  }
 
}



Also found some example but that is not working too...

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
/* **********************************************************
         Exercice d'affichage multiplexé sur une matrice
         de 8x8 LEDs.          PIC16F876A
         - Anodes communes sur le portB et Cathodes sur PortC
 
 ***********************************************************/
int i,j;                     // variable de comptage
int v,lettre;                   // variable de fréquence de scrolling
//unsigned short IncCol;    // Variable d'incrémentation de colonne
unsigned short offset;
void main()    // Programme principal
{
// Préparation du caractère affichable
// Tableau de huits entiers (8x8) */
 
const unsigned char colonnes[][8]={
                                   {0xEB, 0x81, 0x98, 0x3D, 0xBC, 0x19, 0x81, 0xD7},
                                   {0xC3, 0xC3, 0x3C, 0x24, 0x24, 0x3C, 0xC3, 0xC3},
                                   {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff},
                                   {0xEB, 0x81, 0x98, 0x3D, 0xBC, 0x19, 0x81, 0xD7},
                                   {0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55},
                                   {0x42, 0xC3, 0x3C, 0x24, 0x24, 0x3C, 0xC3, 0x42},
                                   {0xC3, 0xC3, 0x3C, 0x24, 0x24, 0x3C, 0xC3, 0xC3},
                                   {0xC3, 0xC3, 0x3C, 0x3C, 0x3C, 0x3C, 0xC3, 0xC3},
                                   {0xC3, 0xC3, 0x00, 0x18, 0x18, 0x00, 0xC3, 0xC3},
                                   {0xC3, 0xC3, 0x00, 0x00, 0x00, 0x00, 0xC3, 0xC3},
                                   {0x24, 0x24, 0xE7, 0x00, 0x00, 0xE7, 0x24, 0x24},
                                   {0x18, 0x24, 0x42, 0x99, 0x99, 0x42, 0x24, 0x18},
                                   {0x00, 0x62, 0x62, 0x7E, 0x62, 0x62, 0x62, 0x00},
                                   {0x00, 0x7E, 0x60, 0x78, 0x60, 0x60, 0x7E, 0x00},
                                   {0x00, 0x3C, 0x62, 0x7E, 0x62, 0x62, 0x62, 0x00},
                                   {0x00, 0x7C, 0x62, 0x7C, 0x62, 0x62, 0x62, 0x00},
                                   {0x00, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00},
                                   {0x00, 0x42, 0x24, 0x18, 0x18, 0x18, 0x3C, 0x00},
                                   {0x18, 0x0C, 0x06, 0xFF, 0xFF, 0x06, 0x0C, 0x18},
 
                                   };
ADCON0=0;  // ADC désactivé
TRISA=0;   // PORTA configuré en sortie
TRISB=0;   // PORTB configuré en sortie
TRISC=0;   // PORTC configuré en sortie
 
PORTA=0;   // mise à zéro des ports A
PORTB=0;   // mise à zéro des ports B
PORTC=0;   // mise à zéro des ports C
lettre=0;
v=0;
j=0;
offset=0;  PortC = 0;
   while(1)                            // Boucle infinie
    {
      for (i=0;i<8;i++)                 // itération sur les 8 lignes
      {
 
        PortB = (colonnes[lettre][i])<<offset;  // output valeur colonnes de la ligne courante
        PortC = 1<<i;                      // sélection ligne courante
 
        Delay_ms(1);
      }
 
 
    }
 
}



and proteus files:
 

Attachments

  • matrix 2.rar
    6.2 KB · Views: 89
  • Matrix Display Test.rar
    9.3 KB · Views: 123

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top