5x7 Led Matrix

Discussion about project that uses other controller, or non controller based project such as using logic gates, FPGA, ARM, Mechanical ....etc. Welcome to post it here

5x7 Led Matrix

Postby Tianjin » Sun Dec 30, 2012 12:20 am

Hi all, I was trying to display alphabets A to Z using p18f4520,ULN2003 and 5x7 led matrix.
I use mplab c compiler,20MHz, and the program was compiled successfully but I doesn't work on protues simulation.
Here's z code, would u tell me why it doesn't display the letters?

unsigned short count, column, num, repeat;
unsigned char fill_1[130]={ 0x7e, 0x09, 0x09, 0x09, 0x7E, // A
0x7f, 0x49, 0x49, 0x49, 0x36, // B
0x3e, 0x41, 0x41, 0x41, 0x22,
0x7f, 0x41, 0x41,0x22, 0x1c,
0x7f, 0x49, 0x49, 0x49, 0x63,
0x7f, 0x09, 0x09, 0x09, 0x01,
0x3e, 0x41, 0x41, 0x49, 0x7a,
0x7f, 0x08, 0x08, 0x08, 0x7f,
0x00, 0x41, 0x7f, 0x41, 0x00, // I
0x20, 0x40, 0x41, 0x3f, 0x01,
0x7f, 0x08, 0x14, 0x22, 0x41,
0x7f, 0x40, 0x40, 0x40, 0x60,
0x7f, 0x02, 0x04, 0x02, 0x7f,
0x7f, 0x04, 0x08, 0x10, 0x7f,
0x3e, 0x41, 0x41, 0x41, 0x3e,
0x7f, 0x09, 0x09, 0x09, 0x06,
0x3e, 0x41, 0x51, 0x21, 0x5e,
0x7f, 0x09, 0x19, 0x29, 0x46,
0x46, 0x49, 0x49, 0x49, 0x31, // S
0x01, 0x01, 0x7f, 0x01, 0x01,
0x3f, 0x40, 0x40, 0x40, 0x3f,
0x1f, 0x20, 0x40, 0x20, 0x1f,
0x3f, 0x40, 0x30, 0x40, 0x3f,
0x63, 0x14, 0x08, 0x14, 0x63,
0x07, 0x08, 0x70, 0x08, 0x07,
0x61, 0x51, 0x49, 0x45, 0x43 // Z
};

//====================MAIN================================

void main(void)
{

ADCON1 = 0b00111101; // configure RA2 and RA5 as digital I/O
ADCON2 = 0b10110100; //// Set result right justified, manual acquisition time, Fosc/4

TRISD=0b00000000; //configure PORTD as output
TRISC=0b00000000; // RC7(RX) as input , RC6(TX) as output
PORTC=0; //intial value of PORTC is zero
PORTD=0; //intial value of PORTD is zero

do{
// Display 26 alphabets
for (num=0; num<26; num++) {

for (repeat=0; repeat<100; repeat++){
column = 1;
for(count = num*5;count < (num*5+6);count++){
PORTC = fill_1[count];
PORTD = column;
Delay10TCYx(200);
column = column<<1;
}
}
}
}
while(1);
}
Tianjin
Novice
 
Posts: 19
Joined: Mon Dec 10, 2012 1:01 am

Re: 5x7 Led Matrix

Postby ABSF » Sun Dec 30, 2012 7:35 am

Did you try slowing down the mcu clock in Proteus, to say 1 or 2 MHz.... What is the proteus loading when you run the simulator?

I checked your codes and it seems OK to me.

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: 5x7 Led Matrix

Postby Tianjin » Sun Dec 30, 2012 3:24 pm

ABSF WROTE:Did you try slowing down the mcu clock in Proteus, to say 1 or 2 MHz.... What is the proteus loading when you run the simulator?

I checked your codes and it seems OK to me.

Allen

thank u. look ,did u see the letters well? I can't see each letters well.
Tianjin
Novice
 
Posts: 19
Joined: Mon Dec 10, 2012 1:01 am

Re: 5x7 Led Matrix

Postby takao21203 » Thu Apr 11, 2013 12:49 am

Normally a font table is placed in the FLASH, so you declare it const.

Also these matrix modules are multiplexed. Depends on the font table, you may have to shuffle the data.

Try to get the matrix drive right at first.

Use conditional compile, and a switch, so you either get data from the table, or you load a test pattern.

When the test pattern works (multiplexing), work out with the font table.

For instance Row 0: 00000001. Row 1: 00000010. And so forth. Checker pattern.

I have built many such circuits, it took hours sometimes. It is not so easy.
User avatar
takao21203
Discoverer
 
Posts: 111
Joined: Mon Mar 19, 2012 7:52 pm
Location: Ireland, Europe


Return to Misc Project

Who is online

Users browsing this forum: No registered users and 6 guests