I have 2 max7219 by 4 boards ... so each 32x8 leds.
2 problems, 1st I can't get hardware spi to work
and 2nd using software spi the characters are in the wrong place and bits missing.
The code is on an arduino nano. I think the pins are correct but not sure of #define Max7219_CS.
Re the overwrite. You need to set the constnat #define MAX7219_X_Devices 8 correctly. I think you have not set? or, it needs to be larger. Essentially, you are overrunning the double buffer. I get the same here if I set the constant to an incorrect value than is less then the phyiscal number of LED modules.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And, check the wiring. The output from the microcontroller goes to the IN on the Module and then from the first modules OUT to the IN on the second module. Your picture looks a tad odd.... hence, me asking you to check
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. Hardware spi now working.
Does #define MAX7219_X_Devices 4 mean four 8x8 led units connected?
What does MAX7219_Y_Devices mean? pset y range increases?
I tried using a 8x32 led unit ie 4 joined-one pcb. I used
~~~
#define MAX7219_X_Devices 4
GLCDCLS
GLCDPrint ( 0, 0, "ABCD")
Max7219_LEDMatrix_Update
~~~
but it prints wrong.
The DIN connection goes to max7219_DO but whether DOUT goes to max7219_DI makes no difference.
My last post was one strip of four modules connected together on one pcb and #define MAX7219_X_Devices 4 and tried leaving blank and using default but same result.
Leds only work one way and tried 2 modules.
If the 4 modules in yours are from left to right 1,2,3,4....ie pset 0,0 top left
mine are 4,3,2,1.
I think different wired modules has been mentioned in the forum.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Do this. remove the the gcdprint. With one module attached add line 0, 0, 63, 71 this should draw a line... post a foto. We need a method to determine the orientation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
DOUT goes to DIN on another device or in using one device back to max7219_DI ......nano miso.
using has no effect.
I could saw the boards to make individual four 8x8 then wire in reverse order and gcb code would work...hmmmm.
I looked at the include file and it was hard to understand first look. include glcd.h in there.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The library is really very similar to the other GLCD libararies. It has INIT, GLCDCLS and PSET - the essential parts of the library.
PSET updated the array. The array is created to match the size the of the LED matrixes. Each Array byte supports 8 LED state of on or off. So, there is an array that is then processed in the SendBuffer methods. This is needed as we dont know the Matrix state so the array holds the state.
We can easily (as I did during development) output this array to a serial terminal. If you use an ANSI terminal then you can reproduce the Matrix state on the the terminal. That was to make sure the simple maths in the array (with PSET) was correct.
We know the Array method works as we have many user happily using this solution. And, I revalidated the solution yesterday.
So, what could your issue be?
The device under the Matrix is not a MAX7219. What are they?
The device is connected differently to the two types we have come across so far. We need to figure out how these are daisy chained to adapt Max7219_LEDMatrix_SendBuffer to handle your modules.
Does one Matrix work? Adapt the PCB to isolate the first Matrix. Set #define MAX7219_X_Devices 1 and then using what is the orientation? Where is the 0,0 pixel? It should be top left as it normal is when have the DIN on the left looking down. If the 0,0 pixel is elsewhere...like bottom right then this information would help understand the orientation of the Matrix.
The other method. Stick them in the post to me.
How cheap were these modules?
Last edit: Anobium 2019-02-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Chip is MAX7219.
With DIN on the left pset 0,0 is bottom right. Chars are upside down.
I'm looking at the max include and
Sub Max7219_LEDMatrix_PSet_90( max7219_LocX as word, max7219_LocY as word, PixelCol)
element = ( max7219_LocX + ( max7219_LocY / 8 ) + 1 )
elementbit = max7219_LocY mod 8
Max7219_Image_Buffer( element ) = Max7219_Image_Buffer( element ) OR FnLSL( PixelCol, elementbit )
Sub Max7219_LEDMatrix_PSet_0( max7219_LocX as word, max7219_LocY as word, PixelCol)
elementbit = max7219_LocX mod 8
element = ( ( max7219_LocX / 8 ) * 8 ) + (8-max7219_LocY)
Max7219_Image_Buffer( element ) = Max7219_Image_Buffer( element ) OR FnLSL( PixelCol, elementbit )
I can't see where they're called. Is this the key to inverting each 8x8 ?
Cost is £3.40 ebay china
Last edit: stan cartwright 2019-02-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dont be looking at PSET to flip until we know how orientation. I think you may need a new routine to flip 90 and flip left-right also. Depends on the answer above.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for your time on this. Wish these were standard.
This max .h is at the moment too complicated for me to understand.
Change Max7219_Image_Buffer( element ) = Max7219_Image_Buffer( element ) OR FnLSL( PixelCol, elementbit )
to FnLSR( PixelCol, elementbit )....ie shift other way for inverted data
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please dont change stuff. Else, I will get very confused as my basline will be different.
So, I am missing lots of information from previous posts.
Does one Matrix work? Adapt the PCB to isolate the first Matrix. Set #define MAX7219_X_Devices 1 and then using what is the orientation? Where is the 0,0 pixel? It should be top left as it normal is when have the DIN on the left looking down. If the 0,0 pixel is elsewhere...like bottom right then this information would help understand the orientation of the Matrix.
2.The other method. Stick them in the post to me.
What happened when you flipped 90? By adding #define Pset max7219_LEDMatrix_PSet_90 to your user program.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And, then, only when you have answered the questions above. Try this, then, publish the results - this will show the buffer to a serial terminal using PUtty.exe
Program, get the PUtty terminal running and you will see this, or, you should. This is the memory array for a four Matrix module. What does yours show? Shown below is the correct array results.
So, I have attached a revision with that has the potential mathematical to resolve the PCB issue.
You have four options - two are tested to work. So, I applied maths to the issue and have calculated the potential option.
Simly try Line 0,0,31,7 with one module attached.
Try each of the four. Select ONLY one. So, uncomment.
'#define Pset max7219_LEDMatrix_PSet_0 'you should have tested this in the previous test
'#define Pset max7219_LEDMatrix_PSet_90 'and, you should have tested this in the previous test
'#define Pset max7219_LEDMatrix_PSet_180 'new test.
'#define Pset max7219_LEDMatrix_PSet_270 'new test.
I have 2 max7219 by 4 boards ... so each 32x8 leds.
2 problems, 1st I can't get hardware spi to work
and 2nd using software spi the characters are in the wrong place and bits missing.
The code is on an arduino nano. I think the pins are correct but not sure of #define Max7219_CS.
I'm telling it to print "ABCD1234567890" but get the display in the image.
Any help appreciated.
Last edit: stan cartwright 2019-02-22
Two issues. One is resolved and hopefully we can resolve the other.
We updated the library this week. https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/include/Max7219_LEDMATRIX_Driver.h?format=raw This will resolve the AVR Hardware SPI issue. The issue was sort of important... the initialisation on the port direction for the SPI ports on an AVR MUST come before the SPI mode is set. Learn something new all the time.
Re the overwrite. You need to set the constnat
#define MAX7219_X_Devices 8
correctly. I think you have not set? or, it needs to be larger. Essentially, you are overrunning the double buffer. I get the same here if I set the constant to an incorrect value than is less then the phyiscal number of LED modules.And, check the wiring. The output from the microcontroller goes to the IN on the Module and then from the first modules OUT to the IN on the second module. Your picture looks a tad odd.... hence, me asking you to check
Thanks. Hardware spi now working.
Does #define MAX7219_X_Devices 4 mean four 8x8 led units connected?
What does MAX7219_Y_Devices mean? pset y range increases?
I tried using a 8x32 led unit ie 4 joined-one pcb. I used
~~~
#define MAX7219_X_Devices 4
GLCDCLS
GLCDPrint ( 0, 0, "ABCD")
Max7219_LEDMatrix_Update
~~~
but it prints wrong.
The DIN connection goes to max7219_DO but whether DOUT goes to max7219_DI makes no difference.
Shouldn't GLCDPrint ( 0, 0, "ABCD") print "A" in the left 8x8 unit?
GLCDPrint ( 8, 0, "ABCD") give the image.
Good news on hardware SPI.
Something is not correct with those modules.
Disconnect and just have one module connected. Then the defaults of shown below should work.
Where 4 is 4 MAX7219's with 4 8x8 LED Matrixes. AKA One 4 piece Module.
I have tested here and I know the code is good, and, we have a number of users with the code operational - so, we need to look at the module.
So, try one module. What happens? Is the last LED matrix inserted the wrong way around? Is the board defective?
My last post was one strip of four modules connected together on one pcb and #define MAX7219_X_Devices 4 and tried leaving blank and using default but same result.
Leds only work one way and tried 2 modules.
If the 4 modules in yours are from left to right 1,2,3,4....ie pset 0,0 top left
mine are 4,3,2,1.
I think different wired modules has been mentioned in the forum.
Yes, the orientation can be changed.
Do this. remove the the gcdprint. With one module attached add
line 0, 0, 63, 71
this should draw a line... post a foto. We need a method to determine the orientation.Are the devices I have now representative of these devices? is it worth your effort.
I want to learn how to map these..from a table maybe.
There is something odd going on. what is the single connection at the OUT for/doing
DOUT goes to DIN on another device or in using one device back to max7219_DI ......nano miso.
using has no effect.
I could saw the boards to make individual four 8x8 then wire in reverse order and gcb code would work...hmmmm.
I looked at the include file and it was hard to understand first look. include glcd.h in there.
See my later post. This is NOT a table but a buffer array. It is very simple as this is the same approach as many of the buffered GLCD libraries.
error in demo ledmatrix_max7219_text_16f18855
Sorted. You can always edit these source files in GitHub to correct.
The library is really very similar to the other GLCD libararies. It has INIT, GLCDCLS and PSET - the essential parts of the library.
PSET updated the array. The array is created to match the size the of the LED matrixes. Each Array byte supports 8 LED state of on or off. So, there is an array that is then processed in the SendBuffer methods. This is needed as we dont know the Matrix state so the array holds the state.
We can easily (as I did during development) output this array to a serial terminal. If you use an ANSI terminal then you can reproduce the Matrix state on the the terminal. That was to make sure the simple maths in the array (with PSET) was correct.
We know the Array method works as we have many user happily using this solution. And, I revalidated the solution yesterday.
So, what could your issue be?
#define MAX7219_X_Devices 1
and then using what is the orientation? Where is the 0,0 pixel? It should be top left as it normal is when have the DIN on the left looking down. If the 0,0 pixel is elsewhere...like bottom right then this information would help understand the orientation of the Matrix.How cheap were these modules?
Last edit: Anobium 2019-02-24
Chip is MAX7219.
With DIN on the left pset 0,0 is bottom right. Chars are upside down.
I'm looking at the max include and
Sub Max7219_LEDMatrix_PSet_90( max7219_LocX as word, max7219_LocY as word, PixelCol)
element = ( max7219_LocX + ( max7219_LocY / 8 ) + 1 )
elementbit = max7219_LocY mod 8
Max7219_Image_Buffer( element ) = Max7219_Image_Buffer( element ) OR FnLSL( PixelCol, elementbit )
Sub Max7219_LEDMatrix_PSet_0( max7219_LocX as word, max7219_LocY as word, PixelCol)
elementbit = max7219_LocX mod 8
element = ( ( max7219_LocX / 8 ) * 8 ) + (8-max7219_LocY)
Max7219_Image_Buffer( element ) = Max7219_Image_Buffer( element ) OR FnLSL( PixelCol, elementbit )
I can't see where they're called. Is this the key to inverting each 8x8 ?
Cost is £3.40 ebay china
Last edit: stan cartwright 2019-02-24
OK. Pset 0,0 bottom right of the first matrix?
Dont be looking at PSET to flip until we know how orientation. I think you may need a new routine to flip 90 and flip left-right also. Depends on the answer above.
To flip 90, just add
#define Pset max7219_LEDMatrix_PSet_90
do not make other changes until we have figured out the orientation.Thank you for your time on this. Wish these were standard.
This max .h is at the moment too complicated for me to understand.
Change Max7219_Image_Buffer( element ) = Max7219_Image_Buffer( element ) OR FnLSL( PixelCol, elementbit )
to FnLSR( PixelCol, elementbit )....ie shift other way for inverted data
OK.
Please dont change stuff. Else, I will get very confused as my basline will be different.
So, I am missing lots of information from previous posts.
2.The other method. Stick them in the post to me.
And, then, only when you have answered the questions above. Try this, then, publish the results - this will show the buffer to a serial terminal using PUtty.exe
Program, get the PUtty terminal running and you will see this, or, you should. This is the memory array for a four Matrix module. What does yours show? Shown below is the correct array results.
So, I have attached a revision with that has the potential mathematical to resolve the PCB issue.
You have four options - two are tested to work. So, I applied maths to the issue and have calculated the potential option.
Simly try Line 0,0,31,7 with one module attached.
Try each of the four. Select ONLY one. So, uncomment.
Anobium
I did isolate first device.
pset 0,0,1 is bottom right.
I didn't get the test program to display anything in putty. I used the usb connection.
Last edit: stan cartwright 2019-02-25
The new include with #define Pset max7219_LEDMatrix_PSet_180 seems ok with 4 devices.
GLCDPrint ( 0, 0, "abcd1234") gives image
Using #define Pset max7219_LEDMatrix_PSet_270 with GLCDPrint ( 0, 0, "abcd1234") gives