MAX7219 component

A forum where Flowcode v7 user created components can be shared, discussed and reviewed.

Moderator: Benj

jgu1
Posts: 1205
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX7219 component

Post by jgu1 »

Hi Martin!

Thank´s for your effort. I am not home today. Tomorrow evening I am home and I test your new component and program. :D

Again thank´s. You hear.

Br Jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

One of the rotations was wrong - needed to flip the Y axis as well!
Max7219MatrixRot.fcpx
(5.57 KiB) Downloaded 150 times
Fixes it..

Let us know how it goes.....

jgu1
Posts: 1205
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX7219 component

Post by jgu1 »

Hi Martin!

I have played a little with your new update. Very nice digit but I still not manage to rotate the digit :(

As you see on picture "not ok" ( yes the digit is fine ) but because of the chip Max7219 I am not able to place them close side by side.

As you on see on "1No space" is the correct place of the Max7219 pcb but now is the orientation of the caracter wrong.

I have made a small testprogram, would you be kind to correct the program so the oritation is correct Please.

Thank´s in advance Martin
Attachments
2Not ok.JPG
2Not ok.JPG (116.43 KiB) Viewed 6147 times
1 No space.JPG
1 No space.JPG (104.37 KiB) Viewed 6148 times
MaxRotate.fcfx
(8.52 KiB) Downloaded 94 times

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

Hi,

Okay - I see the problem. I obviously didn't explain PenRot very well....

PenRot is actually used to display the character (it doesn't set it for subsequent Pen calls - I can see the logic, just wasn't the way I went. I should also have called the argument c 'char' or something more descriptive)
MaxRotate.fcfx
(8.82 KiB) Downloaded 125 times
I've just disabled the calls to Pen and changed/added calls to PenRot to display AB on displays 0 and 1

Martin

jgu1
Posts: 1205
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX7219 component

Post by jgu1 »

Hi Msrtin!

Yes, now I think I see your point to use the PenRot. And yes now it is the correct orientation :D , but only one (the first "digit" is working :?: comming strage sign in the other

I change the project to an Arduino Uno and use port B0 1 2.

Br jorgen.
Attachments
MaxRotate2.fcfx
(8.64 KiB) Downloaded 101 times
One digit.JPG
One digit.JPG (129.03 KiB) Viewed 6137 times

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

Hi Jorgen,

Nearly there!

I think this is probably a timing / noise issue. Try using very short interconnect wires between the modules - for example I can run 8 displays if I connect the second bank of 4 by 'poking' the 'in' pins into the 'out' sockets of the first array of 4 displays. However - if I use jumper wires (~15cm) then things stop working...

Alternatively some sort of shielding of or heavier gauge wires may help? Changing the value of the prescaler to slow things down a bit might be worth a try as well? Though I've just tried setting to Fosc/64 and although things are a lot slower on 4 displays - things don't improve when using the jumpers...

Occasionally I need to pull the power on the Max7219s as well - seem to get some corruption (always whilst programming the Arduino) - that resists overwriting (takes the form of 'stuck' pixels)

Did you get the demo program to work with the four displays??

[img]five%20displays.jpg[/img]
Attachments
five displays.jpg
five displays.jpg (170.38 KiB) Viewed 6132 times

jgu1
Posts: 1205
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX7219 component

Post by jgu1 »

Hi Martin!

Yaeh, I think you rigth :D I took some shorter wires and after downloading the program, I removed the USB and restart the Uno and also remove the powersupply and then power up again. Perfect. The orientation also work fine. :D :lol:

Nice job you have done Martin Now I will play with it. Maybe I have some more question later :wink:

Thanks again.

Br jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

No problem.

If I can help with anything then please don't hesitate to ask...

Martin

jgu1
Posts: 1205
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX7219 component

Post by jgu1 »

Hi again :lol: Quicly

Martin would you be so kind to create a little program how to scroll a string with rotating/oritation the text. Please

Jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

For fun:

I created a 'tower' clock using an Arduino Nano, a RTC (DS3231) and a 4 x8x8 Max7219 display.

I noticed that the RTC board could plug in opposite pins A2 to A7 and SDA and SCL would be next to the corresponding Arduino pins (A4/A5). I thought a five jumper clock was on the cards - but no. Plugging the matrix display into the breadboard (opposite pins d5..d9) - and (although it's probably pushing the current allowance for an Arduino pin a bit) worked fine. So using A2/A3 to power the RTC and D5/D6 to power the display.

Presenting the ZERO jumper breadboard tower clock :D
tower clock.fcfx
(12.4 KiB) Downloaded 130 times
Seconds are displayed as a moving dot on the right of the display - and in the tradition of quick and dirty hacks - I use the redrawing of the time to erase the 'seconds' dot.. I also haven't tested it at the crucial rollover points (am - pm etc). Jazzing it up is left as an exercise to the reader!

[img]P1040023.JPG[/img]

[img]P1040020.JPG[/img]
Attachments
P1040023.JPG
P1040023.JPG (113.28 KiB) Viewed 6117 times
P1040020.JPG
P1040020.JPG (92.54 KiB) Viewed 6117 times
Last edited by mnf on Thu Jan 04, 2018 9:49 pm, edited 1 time in total.

jgu1
Posts: 1205
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX7219 component

Post by jgu1 »

Very nice Martin. Look good, I have to test it later. :D

When you get time, would you please make a little program with scroll and orientate the text please.

Br Jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

Martin would you be so kind to create a little program how to scroll a string with rotating/oritation the text. Please
Okay - the standard scroll routines won't work (well they will - but they won't give the effect they are supposed too!) - there are several possible approaches. Currently the routines rely on the buffers mirroring the layout of the pixels - so one approach would be to rotate the buffers before pushing them out to the display(*). For now, I'll go for the easier approach of writing PenAt / StringAt routines which allow a character/string to be placed at arbitary pixel positions - so we can scroll the string by moving the position we print it to.

I'll give it a go!

(*) - this would have the benefit that all the routines would work as is - and the whole display would just have an orientation value for plotting etc.

My first attempt at a PenAt - worked ok for two of the four rotations.. However the other two it scrolled horizontally across each display. But, on the plus side - seemed to be plenty fast enough... I'd wondered in the past about 32 x 32 displays (16 Max7219s - saw one for sale on Amazon?) - and I think the approach would work well for this too. But, for the moment, back to the drawing board.

On second thoughts- the horizontal scrolling might be just what you need - I have a vertical stack of displays - but if you have horizontally arranged displays....
Last edited by mnf on Thu Jan 04, 2018 10:40 pm, edited 2 times in total.

jgu1
Posts: 1205
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX7219 component

Post by jgu1 »

Look forward. Thanks :D

Br Jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

Hi Jorgen,

Phew - couldn't seem to get my head around the rotations needed - think I probably should have gone for a new write to the buffer and use an `existing/ write a new scroll routine :( All the displays are rotated 90degrees making life harder!

Still - got there in the end.....

So for you to (alpha) test. Note that I only have one of the led matrix like the one's you have - and it works on 1 :D

To get it to work with the board plugged into the breadboard I needed swap x and y both set to true (ie chip end or 'in' is down - the PenAt routine likes it this way!). If you use other macros you might need to tweak things slightly. I powered the LEDs from the Arduino as per the tower clock - so get rid of the macros that set the pins to 1 and 0 in the test program if you are doing otherwise (and check the pins in the component.... & don't forget to set the number of digits to what you have (rather than 1))

Note also that there are a few limitations not found in the other component... Strings can be a maximum of 32 characters long (but no check is made) - as using only a byte for arithmetic. The display doesn't really scroll - the string moves, if that makes sense - so that when a new A..Z starts the 'Z' left on the display is overwritten rather than gliding off to the left..

ScrollStr2 - Scrolls the string from the right of the display until the final character is displayed. Uses -

StringAt - which could be used to scroll the string right as well.

If there was interest - I'd like to rewrite to handle bigger / more complicated arrays of LED matrices (I like the 4 x 4 grid model) - however it would be difficult to generalise to either inline / rotated displays. (Possible but likely slower)
Max7219MatrixJGU.fcpx
(6.03 KiB) Downloaded 102 times
TestJGU.fcfx
(8.4 KiB) Downloaded 87 times
(But see next message too!)

I'd recommend the component in earlier message above UNLESS using the specific matrix devices that require a 90deg rotation.
I'm not sure why but with a 4 digit display I get occasional corruption (one display all set / stuck on) With 0 delay it is a lot (big lot) slower than before - and I get a 'speed up' at the start of a string - a delay minimises this effect.... Let me know how you get on!

Martin
Last edited by mnf on Sat Jan 06, 2018 10:46 pm, edited 1 time in total.

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

And.. It was a lot easier to write a new scroll routine to cope with the altered layout of your display...

So. Try ScrollStr3 in:
Max7219MatrixJGU.fcpx
(6.21 KiB) Downloaded 136 times
TestJGU.fcfx
(8.4 KiB) Downloaded 143 times
That's better :D Everything running fast and smooth!

Just to tidy up now!

Martin

jgu1
Posts: 1205
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX7219 component

Post by jgu1 »

Hi Martin!

Ohh, thank you for your work Martin. I am on a trip with my work and not home before Wednesday. Again, as soon I am home again, I make a test.

By the way, last time I added your Max component in the component lib I could not find the component in the drop down list in display´s but have to search in the search function, is that correct?

Anyway look forward to test, and you hear from me.

Br Jorgen
Attachments
Search.PNG
(6.78 KiB) Downloaded 5420 times

jgu1
Posts: 1205
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX7219 component

Post by jgu1 »

Hi Martin!

It work´s. Nice, with correct orientation. :D

Thank you.

Br Jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

Glad it works!

I'll tidy the code a little (get rid of PenAt etc) and re-post. (not tonight though - busy day at work and an eye infection :( )
Is there a need for other rotations (other way up is easy - rotations slightly less so) or scrolling the other direction?

I'd probably add to 'displays' rather than 'Misc' group - then should show up in menus.

Still not much (read any) simulation content. Offers of help gratefully received!

Martin

User avatar
jidepe
Posts: 4
Joined: Sun Nov 11, 2018 2:39 pm
Contact:

Re: MAX7219 component

Post by jidepe »

Hello,

Thanks a lot for your work !

I'll write an article on my blog to explain Matrix Component for my classroom.

https://sti2d-sin-isn.blogspot.com

JD,french teacher

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

Thanks,

Welcome to the forums. Any questions - please ask.

Martin

mnf
Valued Contributor
Valued Contributor
Posts: 860
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: MAX7219 component

Post by mnf »

There's a slightly newer version in http://www.matrixtsl.com/mmforums/viewt ... 76&t=20329

With some 'special' effects - and YouTube videos too. Look out Hollywood :?


Martin

Post Reply