Pages: 1 [2]   Go Down
Author Topic: Scrolling matrix display  (Read 3047 times)
0 Members and 1 Guest are viewing this topic.
Monterey CA
Offline Offline
Sr. Member
****
Karma: 1
Posts: 323
Addicted to Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I wondered about the SPI thing. I thought the max7219 was non-standard SPI unlike the max7221. But I see both ways of talking to it in different sketches. Maybe we could just modify the LEDCONTROL library to use SPI in the library.


Btw I figured out your font table and how that all works. I noticed ~ doesn't work but it should. What is the highest ASCII charc you use? I think I figured it was 32-136. Which after 127 it is the extended charc which doesn't display correctly, so I must be missing something.

RIght now I am working on a breadboard but the PCB's should be here in a few weeks.

Let me know if I can help with anything.

Thanks again, this has really helped a lot more than any other examples. I spent all weekend on this.

Edit: I have to admit the other ones that where smooth didn't use the LEDCONTROL library and just did SPI inside the sketch. Would be nice to see a library that uses SPI.
« Last Edit: September 17, 2012, 04:08:28 pm by MobileWill » Logged

Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560

http://mobilewill.blogspot.com

Monterey CA
Offline Offline
Sr. Member
****
Karma: 1
Posts: 323
Addicted to Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just realized something, if we use SPI then the pin assignments will change right? Oops, I guess time to update my PCB for the next round but I can tweak the current one.
Logged

Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560

http://mobilewill.blogspot.com

Show Your Work
Offline Offline
Edison Member
*
Karma: 14
Posts: 1072
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I never tried a tilde.  I got the character set from a font generation program called cv_fonted which is here:

https://forum.crystalfontz.com/showthread.php?3619-Bitmap-font-editor-for-graphic-LCD

The font data for character 126 is 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, so clearly that is blank.  If you want a tilde either download cv_fonted and use the editor or make a guess and roll your own.  This data is row-wise so here is a guess:

Code:
12481248
________  0x00
________  0x00
________  0x00
_XX_____  0x06
X__X__X_  0x49
____XX__  0x30
________  0x00
________  0x00

{0x00, 0x00, 0x00, 0x06, 0x49, 0x30, 0x00, 0x00}

There is a newer version of cv_fonted which, while it is a lot better, it doesn't have an 8x8 font which is what I wanted.
« Last Edit: September 17, 2012, 05:02:18 pm by JoeN » Logged

I have only come here seeking knowledge. Things they would not teach me of in college.

Monterey CA
Offline Offline
Sr. Member
****
Karma: 1
Posts: 323
Addicted to Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. Then the length would be 8 right?

So are the ones after the tilde the extended ascii characters or you just used whatever it generated?


I might try this font table

http://www.gammon.com.au/forum/?id=11516

Of course I can't use the whole table since it won't fit in memory, well it might on the 32u4, which I will be switching too once I get one.
Logged

Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560

http://mobilewill.blogspot.com

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26506
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So it's a tradeoff - 64 bytes (of 2K)  and fast flicker free operation, or flickering operation with all kinds of data processing going on every byte.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Monterey CA
Offline Offline
Sr. Member
****
Karma: 1
Posts: 323
Addicted to Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think I am going to try and rewrite the LEDControl library to use SPI, see how it goes.
Logged

Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560

http://mobilewill.blogspot.com

Show Your Work
Offline Offline
Edison Member
*
Karma: 14
Posts: 1072
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. Then the length would be 8 right?

So are the ones after the tilde the extended ascii characters or you just used whatever it generated?


I might try this font table

http://www.gammon.com.au/forum/?id=11516

Of course I can't use the whole table since it won't fit in memory, well it might on the 32u4, which I will be switching too once I get one.

The bottom of the array:

Code:
       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x1C, 0x2A, 0x49, 0x49, 0x41, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x51, 0x49, 0x41, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x79, 0x41, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x49, 0x51, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x49, 0x49, 0x2A, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x49, 0x45, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x4F, 0x41, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x45, 0x49, 0x41, 0x22, 0x1C, 0x00};

becomes:

Code:
0x00, 0x00, 0x00, 0x06, 0x49, 0x30, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x1C, 0x2A, 0x49, 0x49, 0x41, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x51, 0x49, 0x41, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x79, 0x41, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x49, 0x51, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x49, 0x49, 0x2A, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x49, 0x45, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x41, 0x4F, 0x41, 0x22, 0x1C, 0x00,
        0x1C, 0x22, 0x45, 0x49, 0x41, 0x22, 0x1C, 0x00};

The reason there are extras is because the guy who created the font made some hourglass charaters which I guess he needed for his project.




* fonts.jpg (127.28 KB, 658x371 - viewed 101 times.)
Logged

I have only come here seeking knowledge. Things they would not teach me of in college.

Monterey CA
Offline Offline
Sr. Member
****
Karma: 1
Posts: 323
Addicted to Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, I will checking out the program when I get home.

Then for the length you just put in the number of columns plus 1?
Logged

Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560

http://mobilewill.blogspot.com

Show Your Work
Offline Offline
Edison Member
*
Karma: 14
Posts: 1072
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The flaw in the design where there is some jitter in the display is a software problem on my side, not the LED library or hardware.  What this software does is scan each row by advancing the current bit being displayed on the current character in the string until it gets to the end of that character (by length lookup) and then advancing to the next character.  After each row it restores the position and advances the row until it gets to row 8.  At the end of writing the rows, the software restores the position and advances by one bit (column) to achieve the scrolling effect.  It has to know the correct current character to look up the current character length.  Even though the software it restores the start bit position and character in string position it does not restore the current character correctly for length lookup, it uses whatever character was displayed (or partially displayed) last.  This causes the counter not to advance a lot of the time and the jitter.  If you are using my software for scrolling purposes, fix it with this change.  Add the one line indicated.

Code:
   curcharix = curcharixsave2;
    curcharbit = curcharbitsave2;
  
    // advance the current character bit of current character

to

Code:
   curcharix = curcharixsave2;
    curcharbit = curcharbitsave2;
  
    curchar = msg[curcharix];
  
    // advance the current character bit of current character

Sorry for anyone that was inconvenienced by this bug.  I actually totally rewrote the part of the code that writes to the MAX7219s and eliminated the LEDLibrary and this bug persisted which led me to the obvious conclusion that my code sucked somewhere.   At least now I know how the MAX7219 works on a register level, though.  The new version can scroll the display so fast it is not readable without a decent delay.

Attached code has been updated.
« Last Edit: September 22, 2012, 11:26:57 pm by JoeN » Logged

I have only come here seeking knowledge. Things they would not teach me of in college.

Monterey CA
Offline Offline
Sr. Member
****
Karma: 1
Posts: 323
Addicted to Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you so much! It works. I can't believe that is all it was.
Logged

Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560

http://mobilewill.blogspot.com

Pages: 1 [2]   Go Up
Jump to: