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.

[MikroC Pro] LED Matrix help needed

Status
Not open for further replies.

Hearty

Newbie level 4
Joined
Dec 27, 2009
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
France
Activity points
1,343
Hi,

Before all, I'm not english, so sorry if my words are not correct.

I'm working on a LED matrix display,
The code is wrote under MikroC pro.
The pic is a 16f876a,

I have, actually 3 matrix, each drived via a 74hc595, and used SPI protocole.
all is work fine.

Here is my problem,

I have an array contained all charactères ascii table named "ASCII",
something like:

Code:
const unsigned short ASCII[] = {

        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0xBF, 0x00, 0x00, 0x00,  // Code pour char !
        0x00, 0x24, 0x7E, 0x24, 0x24, 0x7E, 0x24, 0x00,  // Code pour char #
        0x00, 0x26, 0x49, 0x49, 0xFF, 0x49, 0x32, 0x00,  // Code pour char $
        0x00, 0x46, 0x26, 0x10, 0x08, 0x64, 0x62, 0x00,  // Code pour char %
        0x00, 0x70, 0x8E, 0x89, 0x99, 0x76, 0xC0, 0x00,  // Code pour char &
        0x00, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char '
        0x00, 0x7E, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char (
       ..
       ..
       etc... 
};

actually I can display and scroll all table's characteres,

I would like to know how can I type a message in a variable,
something like

MyTxt =" HELLO WORLD";

I don't know how I can do the relation between my ASCII array and the MyTxt variable.
I hope my question is clear.

Regards,


here is what I have actually

 

I don't know how I can do the relation between my ASCII array and the MyTxt variable.

what does that mean?
 

Hi Hearty,

Just read Rojo's post here :
 
  • Like
Reactions: Hearty

    Hearty

    Points: 2
    Helpful Answer Positive Rating
sounds like the original poster was trying to figure out a way to output his own string to the led matrix?

if s/he wrote the code to display all ascii characters, it would be extremely silly if s/he couldn't get the same routines to display a given string.
 

Hi,

Hugo,
Thank you for your answer,
I'll read all of this post to find and understand the way.

Millwood,
I'm new in C and the PIC.

After several readings on the net
about my subject, I understand
the principle of storage and display
characters on a panel LED matrix.
The code I wrote is my creation (after several night on it),

Now, I only just hangs on how to proceed
then manipulate this table in my own way.

I guess/hope the Hugo's link will help me.

thank you all for reading and answering.
I'll back to say if I found/understand the solution.

Regards,

PS: Hearty is "He" ;)
 

the funny thing is that you have already have the necessary routines in your code to output the ascii table on the dot matrix. or you couldn't have produced that display.

all you need to do is to utilize those routines so that it just display the desired strings.

that's why your ask is very odd, to say the least.
 

Hi,

MillWood,
my problem is not to display something,

The difficult now for me, is use this array
more confortable, and write a variable as MyText=" The texte I want"

But I don't understand how this variable will search the correct charactere
corresponding into the array.

In your answer, I guess the solution seems to be very simple,
you means, if I understand how to make the array and display it,
I need to understand how to make relation between Mytext and my array.

But in fact, no,
actually I don't know how.

But if you have this simple solution, maybe you can share it,
because I don't understand what is "very odd" in my question.
that's the reason of my post.

Regards,
 

I don't have a solution, you MUST have the solution now, otherwise your code couldn't have displayed the ascii table as shown in the video. so there MUST be a way in your code to display a string.

since you are the only one who knows about your code, you are the only one who can tell how your code works and how to modify it.

it is odd in that you have designed a piece of code that displays the ascii table (which is a string), yet, you cannot use the same code to display a given string.
 

MillWood,
Thank you for your helpfull intervention,

I hope Hugo's answer will show me the way.

Regards,
 

Dear Hearty,

I tried to move message on LED Matrix using PIC and 74hc595, but
I can't use shift register.
I need c Code to understand shift reg. operation

THANKS
 

Hi,

You can see the source on my blog

And you can see the experiments I made before to arrive to this result

595 Experiment
simple one LED matrix scrolling

Hope that will help you, even it's in French, google translation will help you.

Maybe it's not the best way to do that, I'm not a professionnal coder, but it work.
By the way, as I said before I'm still trying to find how I can put a text more confortable
using the ASCII array.
I read again and again the link that Hugo was kindly provided,
it still blur for me, but I will end up understanding (I hope) ;)

Best regards,
 

Hi Hearty,

It's not so complicated but you have to take some time to understand it ...

( a few years ago i've played with an 18F452 , ULN2803 and 8X8 led matrix display)


unsigned char led_chars[94][8] = { } // led character definitions


message[0]=' ';
message[1]='T';
message[2]='E';
message[3]='S';
message[4]='T';
message[5]=' ';

charOffset = 0;
currentChar = 0;

dataPtr = &led_chars[message[0] - 32][0];

for(m=0;m<MAX_ARRAY+8;m++) // init buffer array
{
ledArray[m] = 0;
}

for (i = 0; i <MAX_ARRAY; i++) // filling the data to the buffer array
{
ledArray = *dataPtr++;
if (++charOffset==8) {
charOffset = 0;
if (++currentChar == NR_CHARS)
currentChar = 0;
dataPtr = &led_chars[message[currentChar] - 32][charOffset];
}
}

drowPtr = &ledArray[0] ; //sending out the data to PORTB

PORTB=*drowPtr++;

these are the basic steps ...

another usefull example here :

https://www.microsyl.com/index.php/2010/03/24/led-sign-with-mmc-memory-card/
 
  • Like
Reactions: Hearty

    Hearty

    Points: 2
    Helpful Answer Positive Rating
Hi,

Hugo,
Many thank you again for your answer,
Sorry for the late answer, I'm trying to understand.

I have many difficult with pointers, arrays and char sequences
and more over, your exemple code is for a 2d array
mine is a simple array as you can see in the blog's link contained my code.

In my reflexion,
for txt[]={"HELLO"}
for exemple the "H" character is 72 ascii code
I have to find a good conversion to arrive to this result
72-32 // -32 because my array begin at 32
=40 // H in my array is 40 but 40 is the beginning of my octet
so I need to have 40 + 8 to have my entire character draw.

So for "HELLO"
I need to have an array buffer with recompose
something like:

BufferTxt[]={
H0,H1,H2,H3,H4,H5,H6,H7,
E0,E1,E2,E3,E4,E5,E6,E7,
L0,L1,L2,L3,L4,L5,L6,L7,
L0,L1,L2,L3,L4,L5,L6,L7,
etc...
}

I have many difficults to associate all of these reflexion...
if you add the thousand error message of compilator about error pointer, need pointer etc...

My actually question, is, am I in the right way of reflexion or absolutly wrong.

Regards,
 

"BufferTxt[]={
H0,H1,H2,H3,H4,H5,H6,H7,
E0,E1,E2,E3,E4,E5,E6,E7,
L0,L1,L2,L3,L4,L5,L6,L7,
L0,L1,L2,L3,L4,L5,L6,L7,
etc...
}"

That's right ...

"I have to find a good conversion..."

You don't because it's already there ...

dataPtr = &led_chars[message[currentChar] - 32][charOffset];

so as I said you're filling the array according to the message you want to display than you're going to send it to the display ( to anodes ) and you also have to sync the cathodes with the array and you're done ...

Just play with it for awile until you fully understand it than the real challenge starts ...
building a display with 10 8x8 led matrix and driving it efficiently (row scanning ) etc
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top