• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

(solved)matrix, longer strings of text?

fezder

Well-Known Member
Thread starter #1
Right, topic says my problem quite well, i managed to build circuit and code for 8x8 matrix to display and scroll 8x8 patterns.....but obviously that's quite limited! I could use pre-made libraries but managed to do this without, but i can't figure out how to make longer chains of text? as now both shift registers use same array and a++ counter, if i increase array and count sequence, columns mess up. i tried to makde x as 16 rows long and clumns would be a / 2 = 8 maxinum but no avail. all i've gotten is mess. any tips? of course i could build bigger square matrix and add more shift register but than i'm again limited by 16 rows of text, that only moves the problem to future....not needed! schematic is as follows and code so far:

74595_8x8_matrix.png

C:
int dataPin = 2;        //IC 14       //Define which pins will be used for the Shift Register control
int latchPin = 3;       //IC 12
int clockPin = 4;       //IC 11
//OE-GND
//MR-VCC
int const t = 2000;

byte x [] =
{
  B00001000,
  B00001100,
  B00001110,
  B01111111,
  B01111111,
  B00001110,
  B00001100,
  B00001000,
};

byte columns [] =
{
  B00000001,
  B00000010,
  B00000100,
  B00001000,
  B00010000,
  B00100000,
  B01000000,
  B10000000,
};


void setup()
{
  DDRD = DDRD | B00011100;                                  //set pins as output

}

void loop()
{
  for (int shift = 0 ; shift < 7 ; shift++ )                   //amount to shift
  {
    for (int hold = 0; hold < 15; hold++)                       //time for shifting
    {
      for (int a = 0; a < 8; a++)                               //how many arrays to load?
      {
        PORTD = B00000000;                                  //turn latch low
        shiftOut(dataPin, clockPin, MSBFIRST, columns[a]);          //Send the data #2        (what columns to power)
        shiftOut(dataPin, clockPin, LSBFIRST, x[a]>>shift);          //Send the data #1       ( what data to draw)    
        PORTD = B00001000;                                  //turn latch on->show screen
        delayMicroseconds (t);
      }
    }
  }
}
 
Last edited:

be80be

Well-Known Member
#2
I been playing a little with this and what I did was figure how long a sentence I would be using. Then it's just a simple shift. My end goal is to send out any word just as a 2x16 lcd would. So you send Cat it loops long enough to see it spelled out. But I keep getting side tracked and with work I don't have much time during the week be to work and come home fix dinner and go to bed LOL.
 

fezder

Well-Known Member
Thread starter #3
yeah, it would be much easier using lcd or library, but again, i'm willing to learn along the way. trouble is, most ppl seem to use that max's ic, not shift register. and when i find someone that used shift register, there's nothing said HOW it is hooked up? i mean are they daisy chained and so on, code is ''useless'' without knowing the hardware it controls IMO. and other thing, soetimes there is small commentary inside code what it does and when. Like when i write code, i like to write it there what it does, it won't take space from micro, at least it won't seem so. (surely it should take space as same strings go to micro)
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#4
I'm not sure what you want fez!!!

Do you want to scroll a sentence through two LED matrices OR!!! have more matrices so you can see more of the sentence??

I have done 8 8x8 matrices running from a pic16... It looked good... I did a video of it!!

There are 7 seven seg displays and 8 matrices...

 

fezder

Well-Known Member
Thread starter #5
Hey Ian, this is what i have so far
what i want, is so i can make longer chains of text/patterns, that scrolls like this:
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#6
The idea is... Grab a 5x8 font from the net!! Create a 24 x 8 buffer and draw the string to the buffer ie

signed int x = 24
print at x--,0 " HELLO WORLD!!"

When you bitblit the string only the part in the buffer will be seen!!
 

fezder

Well-Known Member
Thread starter #7
ah, so that's the basic idea, hmm, but, what about when i control two shift registers that are chained together? does that complicate things? other controls columns and other rows
 

fezder

Well-Known Member
Thread starter #9
hehe, in fact, i made it working, will post it soonish, if you could tell possible improvements like making that ''string'' more neater, it's not in array yet.
only 3 pins from micro! (of course power line too, but they won't count....)
 

fezder

Well-Known Member
Thread starter #10
Here we go

and code
C:
int dataPin = 2;        //IC 14       //Define which pins will be used for the Shift Register control
int latchPin = 3;       //IC 12
int clockPin = 4;       //IC 11
//OE-GND
//MR-VCC
int delaytime = 1, timer, timerPrev = 0;
int shift = 0;
int len = 32;
static uint8_t  x [32] =
{
  B00000000,
  B00000000,
  B01111110,
  B00001000,                  
  B01111110,
  B00000000,
  B01111110,
  B01001010,

  B01000010,
  B00000000,
  B01111110,
  B00000010,
  B00000000,
  B01111110,
  B00000010,
  B00000000,

  B00111100,
  B01000010,
  B00111100,
  B00000000,
  B00000000,
  B00000000,
  B00000000,
  B00000000,

  B00000000,
  B00000000,
  B00000000,
  B00000000,
  B00000000,
  B00000000,
  B00000000,
  B00000000,
};



void setup()
{
  DDRD = DDRD | B00011100;                                  //set pins as output

}

void loop()
{
  timer = millis ();
  if (timer-timerPrev >100)
  {
    shift++;
    if(shift==len)shift=0;
    timerPrev=timer;
  }
       for(int i=0; i<8; i++)                   
      {
        PORTD = B00000000;                                  //turn latch low
        shiftOut(dataPin, clockPin, MSBFIRST, 1 << i);          //Send the data #2        (what columns to power)
        shiftOut(dataPin, clockPin, LSBFIRST, x[i+shift > len-1 ? i+shift-len : i+shift]);          //Send the data #1       ( what data to draw)    
        PORTD = B00001000;                                  //turn latch on->show screen
        delayMicroseconds (1000);
      }
  

}
 
Last edited:

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#11
Like I said... Grab a 5x8 font off the net..

The font will start at ox20 ( space ) and run to 127 ( ~ ) you can then load them whenever you want..

If you look at the tutorials I did of Nigel's Pic boards ( tutorial 13.2 ). I show how to print a full string to the led matrix.. http://www.electro-tech-online.com/attachments/tutorial13-zip.60067/

You will see how I grab a font character and load the matrix..
 

fezder

Well-Known Member
Thread starter #12
Couple questions: any other reason to use hexadesimals than it makes code a LOT smaller, and clearer (only i have to chech every one via google what hexadesimal is in binary...)
and, why 5x8 pattern? what i see from your video matrix patterns are indeed 5x8 though

and, i suppose this is the net you mentioned? and of course where pattern is held

C:
unsigned char shape[] = {
    0xff,0x81,0x81,0x81,0x81,0x81,0x81,0xff, // square
    0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, // block
    0x00,0x38,0x44,0x4c,0x54,0x64,0x44,0x38, // 0
    0x00,0x38,0x10,0x10,0x10,0x10,0x30,0x10, // 1
    0x00,0x7c,0x20,0x10,0x08,0x04,0x44,0x38, // 2
    0x00,0x38,0x44,0x04,0x08,0x10,0x08,0x7c, // 3
    0x00,0x08,0x08,0x7c,0x48,0x28,0x18,0x08, // 4
    0x00,0x38,0x44,0x04,0x04,0x78,0x40,0x7c, // 5
    0x00,0x38,0x44,0x44,0x78,0x40,0x20,0x18, // 6
    0x00,0x20,0x20,0x20,0x10,0x08,0x04,0x7c, // 7
    0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x38, // 8
    0x00,0x30,0x08,0x04,0x3c,0x44,0x44,0x38}; // 9
 
Last edited:

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#13
The 5x8 font is quite a popular font so there is a few... The one I have in that tutorial is probably a 5x8..
Anywho, The net is the WWW, internet!!

It's not so bad for me as I read hex as simple as you do binary!! Can you imagine all 127 characters in binary!!

Oh Yeah!! The font creator spits out hex as standard..
 

be80be

Well-Known Member
#14
The idea is... Grab a 5x8 font from the net!! Create a 24 x 8 buffer and draw the string to the buffer ie

signed int x = 24
print at x--,0 " HELLO WORLD!!"

When you bitblit the string only the part in the buffer will be seen!!
I don't no how you got libraries from my post Ian is doing what I said they don't have a arduino library for what I have. Have to write it all myself.
A Lcd is a matrix I'm writing code to use a big bunch of blue leds to display like the LCD
You want a A you send print ("A") you want words you send print("I want words")
the table will hold the letters and stuff this way I can change on the fly. Just like sending text to LCD it's a buffer Like this
to scholl a lcd you have to shift data across the screen this is on an pic it don't really use arduino for much
This is on a little 8 pin pic 12f675
 
Last edited:

fezder

Well-Known Member
Thread starter #15
I too use lcd's time to time, much easier to use (well maybe because it's quite must to use librabies....) and i2c adapter makes it even neater. have one 16x4, bigger display with i2c, takes only 2 data lines from micro. Only i wonder how lcd's manage when temperature drops under 0 degrees celsius, at least my car's cd players lcd is ''frozen'' while when starting at cool weather. Hmm, come think of it, i'm not quite sure is it even lcd or is that other that ''rings'' when tapped with finger? like it sounds there would be some sort of ceramic thingy inside, can't recall that displays name
 

fezder

Well-Known Member
Thread starter #16
Anywho, The net is the WWW, internet!!
haha, i understood this part then bit wrong it seems. Just need to find that table/chart now
 

Latest threads

EE World Online Articles

Loading

 
Top