CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

HELP - Ideas for LED Dot-Matrix Display

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

HELP - Ideas for LED Dot-Matrix Display
PostPosted: Sun May 23, 2004 9:58 pm     Reply with quote

Hi,

I am trying to build a large LED dot matrix electronic display board with about 16 x 5 characters. I have been searching around for some time for suitable driver to use but could not find any.

- How actually does those display board in the market or industry work?
- What are the principles that they use?
- What are the popular way of controlling and displaying the message?
- What are the best way or design if we were to use a PIC16F877A

Any suggestions and information are deeply appreciated.

Thank you..

Ernest
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun May 23, 2004 10:18 pm     Reply with quote

We worked on this a few years ago at the company.
It's a complicated subject, if you do a high density panel of RGB LEDs.

For your display, some drivers that you might look at
are the Texas Instruments TLC59xx series.

To see these devices, go to TI's page, and follow this menu:
http://www.ti.com
- TI Home
-- Analog and Mixed Signal Home
--- Interface Home
---- LED Decoders and Drivers
----- Parametric Table

Digikey has these chips. Go to http://www.digikey.com
and search for: TLC59
Also select "Items in Stock". You will get a list of 7 of these chips.

There might also be some easier solution than what I've suggested.
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

HELP - Ideas for LED Dot-Matrix Display
PostPosted: Mon May 24, 2004 7:51 pm     Reply with quote

Thanks a lot for your suggestions.

But would it be much simpler if we only want to drive a panel of single color LED?

Would it be simpler also if we only want to display texts in fixed font within the 5x7 matrix?

We'll probably try out with the text message display first before embarking on the full RGB graphic and text display unit.

Please advise...

Cheers,
Ernest
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Mon May 24, 2004 10:13 pm     Reply with quote

Multiplexing is the way to go. I've used several 7-segment displays and had them multiplexed by the MCU. The segments are all in parallel with each other except for the common pin that is driven by a transistor so that only the number that should appear on each segment shows up. You are doing something that is quite a bit more massive than what I did but you might consider building on that principle. Who knows, you might be able to have a few MCU's to do this and have a 'master' telling each one what do display.

Ronald
Jerry I



Joined: 14 Sep 2003
Posts: 96
Location: Toronto, Ontario, Canada

View user's profile Send private message

Re: HELP - Ideas for LED Dot-Matrix Display
PostPosted: Tue May 25, 2004 8:54 pm     Reply with quote

I have worked with LED type displays.

The drivers that are the most commonly used are available from Marktechhttp://www.marktechopto.com. In the Toshiba drivers 8 bit and 16 bit like TB62706 is very common. These drivers are constant current drivers to the LED. Just set the external resistor and all LED outputs have the same current drive eg. 20ma.

We have also used chips from TI like TPIC6B595 which is also a LED driver. But here each output must have a series resistor to limit the current to the LED. I think TI has new lines of chips in this area, you will have to look for them.

The big question is how are you going to drive the LEDs. Are you going to use discrete LEDs or 5x7 or 8x8 matrix blocks. Drive the LEDs with direct drive or multiplex each row of LED at a time.

With direct drive the cost would be higher in that a single driver like the TI Tpic6b595 has 8 outputs each output would be an LED pixel. Therefore a display with resolution of 96x16 would use 96/8 = 12 Tpic6b595 per row with 16 rows would use 192 chips $$$$.

A cheaper method would be to have one row of Tpic6b595 (latches) then have a transistor for each row of the matrix. Here you would load the data for the particular row then turn on the transistor for approx 16ms then off load data for next row turn on the next transistor and then off and so on.... repeat for all 16 rows and then restart at row 1 again.

Refresh all the rows with approx 1000 Hz. to give good effect with no flicker. you would refresh the whole display 1000/16 = 62.5 times per second 1/62.5 = 16ms on time of transistor.

Because you would turn on the LED row for just a short time you have to drive the LED with a higher current say 90ma to get any brightness out of the row approx 9 Amps 90ma x 96 pixels. In the case of the direct drive system above you would only drive the LED at there rated current of 20ma to get the same brightness.

For using a PIC to drive the display it can be done. You have to have lots of ram So I would at least try to use 18F252/442 that has at least 1.5K of ram. Here you could have a a refresh buffer that this data is constantly read then shifted out to the display drivers. This should be interrupt driven. Then have other buffers to maniplulate the data before it gets transfered the the refresh buffer to be displayed.

For Text messages you would need a character generator for the 5x7 font charcacters fields, this would take up at least 2K of rom space. With a little fancy programing the 5x7 font could be zoomed to 10x14 or even 5x14.

OK I hope I have not discouraged you but it can be done.

I have done it. Cool

If you got the text on the display you have mastered the refresh routine.

Now the fun starts..... Lets see you scroll it Very Happy


Good Luck

Jerry


ernest wrote:
Hi,

I am trying to build a large LED dot matrix electronic display board with about 16 x 5 characters. I have been searching around for some time for suitable driver to use but could not find any.

- How actually does those display board in the market or industry work?
- What are the principles that they use?
- What are the popular way of controlling and displaying the message?
- What are the best way or design if we were to use a PIC16F877A

Any suggestions and information are deeply appreciated.

Thank you..

Ernest
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

Help - How to use RS232 to display characters on dot-matrix
PostPosted: Tue Nov 02, 2004 6:22 am     Reply with quote

Hello, I'm trying to build a 5x7 dot-matrix display using PIC16F877A. So far, I've been able to display scrolling characters on the dot matrix. But it would be much better if user can change the message to be displayed by simply using the RS232.

I've written a program below but it failed to display the message. Please comment on any mistakes done in the program. Is there a better way of writing the program? All advice are much appreciated.

Code:

#if defined(__PCM__)
#include <16F877A.H>
#fuses HS,NOWDT,NOPUT,NOPROTECT,NOBROWNOUT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_A4, rcv=PIN_A5) //use portA instead

#IFNDEF EXP_OUT_ENABLE
#define EXP_OUT_ENABLE PIN_C2
#define EXP_OUT_CLOCK PIN_C1
#define EXP_OUT_DO PIN_C0
#define NUMBER_OF_74595 3 //trying out with 3 ICs
#ENDIF
#include <74595_V02.C>

#byte port_a=5
#byte port_b=6
#byte port_c=7
#byte port_d=8


// TO DISPLAY 5X7 DOT MATRIX CHARACTER
//char const msg[80]={0,0, 127,8,8,8,127, 0,56,84,84,84,24, 0,65,127,64, 0,65,127,64, 0,56,68,68,68,56, 0,88,56,0, 127,8,4,4,120, 0,56,68,68,68,56, 0,60,64,48,64,60, 0,0,32,84,84,84,56, 0,124,8,4,4,8, 0,56,84,84,84,24, 0,0,60,64,64,32,124, 0,2,1,81,9,6};
// ==> ABLE TO DISPLAY: "Hello,how are u?"
// the '0' was placed in front of every char. to give spacing of 1column

char msg[40];
char s1[16];
void get_line1() { // to acquire 16 char.
s1[0]=getc();
printf("\ts1==> %C",s1[0]);
s1[1]=getc();
printf("%C",s1[1]);
s1[2]=getc();
printf("%C",s1[2]);
s1[3]=getc();
printf("%C",s1[3]);
s1[4]=getc();
printf("%C",s1[4]);
s1[5]=getc();
printf("%C",s1[5]);
s1[6]=getc();
printf("%C",s1[6]);
s1[7]=getc();
printf("%C",s1[7]);
s1[8]=getc();
printf("%C",s1[8]);
s1[9]=getc();
printf("%C",s1[9]);
s1[10]=getc();
printf("%C",s1[10]);
s1[11]=getc();
printf("%C",s1[11]);
s1[12]=getc();
printf("%C",s1[12]);
s1[13]=getc();
printf("%C",s1[13]);
s1[14]=getc();
printf("%C",s1[14]);
s1[15]=getc();
printf("%C",s1[15]);
}

char const ascii_char3[6][3] = {
{ 0,11,7 } // ' [0]
{ 0,88,56 } // , [1]
{ 0,96,96 } // . [2]
{ 0,54,54 } // : [3]
{ 0,91,59 } // ; [4]
{ 0,7,11 } // ` [5]
};

char const ascii_char4[11][4] = {
{ 0, 7, 0, 7 } // " [0]
{ 0,28,34,65 } // ( [1]
{ 0,65,34,28 } // ) [2]
{ 0,66,127,64 } // 1 [3]
{ 0,65.127,65 } // I (Capital i)
{ 0,127,65,65 } // [ [5]
{ 0,65,65,127 } // ] [6]
{ 0,68,125,64 } // i [7]
{ 0,65,127,64 } // l (Small L)
{ 0,8,54,65 } // { [9]
{ 0,65,54,8 } // } [10]
};

char const ascii_char5[8][5] = {
{ 0, 8,62, 8, 8 } // + [0]
{ 0,8,20,34,65 } // < [1]
{ 0,65,34,20,8 } // > [2]
{ 0,56,68,68,68 } // c [3]
{ 0,32,64,68,61 } // j [4]
{ 0,127,16,40,68} // k [5]
{ 0, 4,63,68,68 } // t [6]
{ 0, 2, 1, 2,42 } // ~ [7]
};

char const ascii_char6[30][6] = {
{ 0, 20,127,20,127,20 } // DEC 35 '#' [0]
{ 0, 36, 42, 127, 42, 18 } // 36D '$' [1]
{ 0, 39, 21, 107, 84, 114 } // 37D '%' [2]
{ 0, 54, 73, 86, 32, 80 } // 38D '&' [3]
{} //0, 11, 7 // 39H [4]
{} //0, 28, 34, 65 // 40D [5]
{} //0, 65, 34, 28 // 41D [6]
{ 0, 42, 28, 127, 28, 42 } // 42D '*' [7]
{} //0, 8, 62, 8, 8 // 43D [8]
{} //0, 88, 56 // 44D [9]
{ 0, 8,8,8,8,8 } // 45D '-' [10]
{} //0, 96, 96 // 46D [11]
{ 0, 32, 16, 8, 4, 2 } // 47D '/' [12]
{ 0, 62, 81, 73, 69, 62 } // 48D '0' [13]
{} //0,66, 127, 64 // 49D [14]
{ 0, 114, 73, 73, 73, 70 } // 50D '2' [15]
{ 0, 34, 65, 73, 73, 54 } // 51D '3' [16]
{ 0, 24, 20, 18, 127, 16 } // 52D '4' [17]
{ 0, 39, 69, 69, 69, 57 } // 53D '5' [18]
{ 0, 120, 74, 73, 73, 48 } // 54D '6' [19]
{ 0, 1, 113, 9, 5, 3 } // 55D '7' [20]
{ 0, 54, 73, 73, 73, 54 } // 56D '8' [21]
{ 0, 6, 73, 73, 41, 30 } // 57D '9' [22]
{} //0, 54, 54 // 58D [23]
{} //0, 91, 59 // 59D [24]
{} //0, 8, 20, 34, 65 // 60D [25]
{ 0, 20, 20, 20, 20, 20 } // 61D [26]
{} //0, 65, 34, 20, 8 // 62D [27]
{ 0, 2, 1, 81, 9, 6 } // 63D [28]
{ 0, 50, 73, 121, 65, 62 } // 64D [29]
};

char const ascii_char7[31][6] = {
{ 0, 124, 18, 17, 18, 124 } // 65
{ 0, 65, 127, 73, 73, 54 } // 66
{ 0, 62, 65, 65, 65, 34 } // 67
{ 0, 65, 127, 65, 65, 62 } // 68
{ 0, 127, 73, 73, 65, 65 } // 69
{ 0, 127, 9, 9, 1, 1 } // 70
{ 0, 62, 65, 73, 73, 58 } // 71
{ 0, 127, 8, 8, 8, 127 } // 72
{ } // 0, 65, 127, 65 // 73 X
{ 0, 32, 64, 65, 63, 1 } // 74
{ 0, 127, 8, 20, 34, 65 } // 75
{ 0, 127, 64, 64, 64, 64 } // 76
{ 0, 127, 2, 12, 2, 127 } // 77
{ 0, 127, 2, 4, 8, 127 } // 78
{ 0, 62, 65, 65, 65, 62 } // 79
{ 0, 127, 9, 9, 9, 6 } // 80
{ 0, 62, 9, 81, 33, 94 } // 81
{ 0, 127, 9, 25, 41, 70 } // 82
{ 0, 38, 73, 73, 73, 50 } // 83
{ 0, 1,1,127, 1, 1 } // 84
{ 0, 63, 64, 64, 64, 63 } // 85
{ 0, 7, 24, 96, 24, 7 } // 86
{ 0, 127, 32, 24, 32, 127 } // 87
{ 0, 99, 20, 8, 20, 99 } // 88
{ 0, 3, 4, 120, 4, 3 } // 89
{ 0 97, 81, 73, 69, 67 } // 90
{ } // 0, 127, 65, 65 // 91 X
{ 0, 2, 4, 8, 16, 32 } // 92
{ } //0, 65, 65, 127 // 93 X
{ 0, 4, 2, 1, 2, 4 } // 94
{ 0, 64, 64, 64, 64, 64 } // 95
};

char const ascii_char8[26][6] = {
{ 0, 32, 84, 84, 84, 56 } // 97
{ 0, 127, 40, 68, 68, 556 } // 98
{ } // 0, 56, 68, 68, 68 // 99 X
{ 0, 56, 68, 68, 40, 127 } // 100
{ 0, 56, 84, 84, 84, 24 } // 101
{ 0, 8, 63, 9, 9, 2 } // 102
{ 0, 8, 84, 84, 84, 60 } // 103
{ 0, 127, 8, 4, 4, 120 } // 104
{ } // 0, 68, 125, 64 // 105 X
{ } // 0, 32, 64, 68, 61 // 106 X
{ } // 0, 127, 16, 40, 68 // 107 X
{ } //0, 65, 127, 64 // 108 X
{ 0, 124, 4, 120, 4, 120 } // 109
{ 0, 124, 8, 4, 4, 120 } // 110
{ 0, 56, 68, 68, 68, 56 } // 111
{ 0, 124, 20, 20, 20, 8 } // 112
{ 0, 8, 20, 20, 20, 124 } // 113
{ 0, 124, 8, 4, 4, 8 } // 114
{ 0, 72, 84, 84, 84, 36 } // 115
{ } //0, 4, 63, 68, 68 // 116 X
{ 0, 60, 64, 64, 32, 124 } // 117
{ 0, 28, 32, 64, 32, 28 } // 118
{ 0, 60, 64, 48, 64, 60 } // 119
{ 0, 68, 40, 16, 40, 68 } // 120
{ 0, 12,80, 80, 80, 60 } // 121
{ 0, 36, 100, 84, 76, 36 } // 122
};


main()
{
int n = 0;
int mask[4];
int data[4];
int delaycount;
int startposition;
int index;
int i = 0; int x = 0; int y = 0; // x=counter for row, y=counter for column ie. [x][y]
int z = 0; // to count size of msg[]
mask[0] = 0x01; mask[1] = 0x00; mask[2] = 0x00; mask[3] = 0x00;

set_tris_b(0); //set portb to outputs
set_tris_c(0); //set portc to outputs
set_tris_d(0);
port_b = 0;
port_c = 0; //zero port c
startposition = 0;

msg[0] = ascii_char6[1][0]; // $
msg[1] = ascii_char6[1][1];
msg[2] = ascii_char6[1][2];
msg[3] = ascii_char6[1][3];
msg[4] = ascii_char6[1][4];
msg[5] = ascii_char6[1][5];

msg[6] = ascii_char6[22][0]; // 9
msg[7] = ascii_char6[22][1];
msg[8] = ascii_char6[22][2];
msg[9] = ascii_char6[22][3];
msg[10] = ascii_char6[22][4];
msg[11] = ascii_char6[22][5];

msg[12] = ascii_char5[7][0]; // ~
msg[13] = ascii_char5[7][1];
msg[14] = ascii_char5[7][2];
msg[15] = ascii_char5[7][3];
msg[16] = ascii_char5[7][4];

msg[17] = ascii_char3[2][0]; // .
msg[18] = ascii_char3[2][1];
msg[19] = ascii_char3[2][2];

msg[20] = ascii_char4[7][0]; // i
msg[21] = ascii_char4[7][1];
msg[22] = ascii_char4[7][2];
msg[23] = ascii_char4[7][3];

z = sizeof(msg);


do
{

if(!input(PIN_E1)) // if RE1 == LOW (pressed)
{
printf("\r\nEnter the char.: ");
get_line1(); // acquire 16 char.
n = 0; z=0;

for(n=0; n<8 ; n++) // allow display of 8 char.
{

if(s1[n]==32) // ' BLANK ' ==> 1 column
{ msg[n]=0; z+=1;}


if(s1[n]==33) // ' ! ' ==> 2 columns incl.LEADING SPACE
{ msg[n]=0;
msg[n+1]=95;
z+=2; }

// ==> 5 columns incl. LEADING SPACE
if((s1[n]==43)&&(s1[n]==60)&&(s1[n]==62)&&(s1[n]==99)&&(s1[n]==106)&&(s1[n]==107)&&(s1[n]==116)&&(s1[n]==126))
{
if(s1[n]==43)
x = 0;
if(s1[n]==60)
x = 1;
if(s1[n]==62)
x = 2;
if(s1[n]==99)
x = 3;
if(s1[n]==106)
x = 4;
if(s1[n]==107)
x = 5;
if(s1[n]==116)
x = 6;
if(s1[n]==126)
x = 7;

for(y=0;y<5;y++)
{
msg[z+y] = ascii_char5[x][y];
}
z+=5;
} // end of IF s1 compare for 5columns


// ==> 4 columns incl. LEADING SPACE
if((s1[0]==34) && (s1[0]==40) && (s1[0]==41) && (s1[0]==49) && (s1[0]==73) && (s1[0]==91) && (s1[0]==93)
&& (s1[0]==105) && (s1[0]==108) && (s1[0]==123) && (s1[0]==125))
{
switch(s1[n])
{
case 34: x=0; break;
case 40: x=1; break;
case 41: x=2; break;
case 49: x=3; break;
case 73: x=4; break;
case 91: x=5; break;
case 93: x=6; break;
case 105: x=7; break;
case 108: x=8; break;
case 123: x=9; break;
case 125: x=10; break;
}

for(y=0;y<4;y++)
{
msg[z+y] = ascii_char4[x][y];
}
z+=4;
} // end of IF s1 compare for 4columns


// ==> 3 columns incl. LEADING SPACE
if((s1[n]==39) && (s1[n]==44) && (s1[n]==46) && (s1[n]==58) && (s1[n]==59) && (s1[n]==96))
{
switch(s1[n])
{
case 39: x=0; break;
case 44: x=1; break;
case 46: x=2; break;
case 58: x=3; break;
case 59: x=4; break;
case 96: x=5; break;
}

for(y=0;y<3;y++)
{
msg[z+y] = ascii_char3[x][y];
}
z+=3;
} // end of IF s1 compare for 3columns

} //END OF for-loop for n-flag

} // END of INPUT(PIN_E1)




delaycount=5;
while (delaycount)
{
index = startposition;


for (i=0;i<32;i++) // we have 32 columns to drive //for (i=0;i<32;i++) //
{
// store our mask in an array. we need to do this because
// the call to write_expanded_outputs will destroy the value
// passed in.
data[0] = mask[0]; // store which column we are driving
data[1] = mask[1]; // in an array
data[2] = mask[2];
data[3] = mask[3];

if(!input(PIN_E2)) // to allow user to FREEZE DISPLAY/SCROLLING when RE2==LOW
delaycount = 4;

index = i + startposition; // point to the next pattern to display
if (index >= z) //sizeof(msg)) // make sure that we don't exceed the array
index -= z; //sizeof(msg);

// port_b = 0; // disable driving the LEDs
//port_d = 0; // use port d to drive ROWS
port_d=0;
write_expanded_outputs(data); // enable our column driver



// port_b = msg[index]; // drive our LEDs
port_d = msg[index];

if (shift_left(mask,4,0))
mask[0] = 0x01;
delay_us(750); // adjust this value to control the drive time
//for the leds
}

--delaycount; // decrement our delay loop counter
}

++startposition; // Point to the next data pattern

if (startposition >= sizeof(msg)) // make sure that we don't exceed the array
startposition = 0;

// if(!input(PIN_E1)) // to allow user to FORCE the display to RETURN to ORIGIN when RE1==LOW
// {
// startposition = 2; // reset starting position with OFFSET of 2 (otherwise 2 trash column will be shown)
// index = 0; // reset index
// i = 0; // reset i count
// }

} while(1); // END while(1)
} // END main()

THANK YOU.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 02, 2004 11:24 am     Reply with quote

Before posting over and over and over and over, kindly check when you get an error such as timeout to see if it actually failed or indeed was posted. This happens quite a bit if you post a large amount of code.
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

PostPosted: Tue Nov 02, 2004 6:11 pm     Reply with quote

Dear all,

So sorry about this...I didn't expect this multiple postings to happen. Everytime I clicked on the submit button, I get a timeout error and the delivery failed. So, I have to resend/resubmit the posting until I get a notification that the message has been successfully sent.

So sorry again for the trouble and inconvenient caused. I must be very anxious and eager to solve the problem.

Ernest

++++++++++++++++++++
Fixed. Deleted 5 multiple posts.

-- Forum Moderator
++++++++++++++++++++
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group