Has anyone got working code for Max7219
Has anyone got working code for Max7219
I'm having issues getting the max7219 on a dot matrix display to behave as it should.
Not sure if its timing or misunderstanding of what i need to do, but i've looked at many arduino examples and it shouldn't be too hard to replicate
https://www.best-microcontroller-projec ... x7219.html
i'm bit banging it as i've done before with shift registers
if anyone has any experience or code that would be appreciated
Not sure if its timing or misunderstanding of what i need to do, but i've looked at many arduino examples and it shouldn't be too hard to replicate
https://www.best-microcontroller-projec ... x7219.html
i'm bit banging it as i've done before with shift registers
if anyone has any experience or code that would be appreciated
Re: Has anyone got working code for Max7219
It looks fairly straightforward. I'm willing to take a look at your code if you'd like.FFMan wrote:I'm having issues getting the max7219 on a dot matrix display to behave as it should.
- Don Kinzer
Has anyone got working code for Max7219
I would be interested in seeing the code that finally made it work.
Eric Serdahl.
Sent from my iPad Air 2
On Mar 27, 2019, at 2:20 PM, ZBasic <zbasic.forum@zbasic.net (zbasic.forum@zbasic.net)> wrote:
Eric Serdahl.
Sent from my iPad Air 2
On Mar 27, 2019, at 2:20 PM, ZBasic <zbasic.forum@zbasic.net (zbasic.forum@zbasic.net)> wrote:
thanks don - just about cracked it now.
a wiring issue and fiddled with the timing. the only issue being the init commands leave a pattern on the display, but if i quickly clear line by line it's not noticeable.
Here is some roughish test code - but it works.
- Attachments
-
- MatrixTest.pjt
- (73 Bytes) Downloaded 479 times
-
- MatrixTest.bas
- (3.69 KiB) Downloaded 484 times
-
- MatrixDispFns.bas
- (2.88 KiB) Downloaded 479 times
comments on how most efficiently to store the font data welcome as each character is 8 bytes - not a lot really but i want entire alphabet and maybe upper and lower case.
https://xantorohara.github.io/led-matrix-editor/#
I think i recall i can put that in progmem somehow ?
Scrolling is i guess easily achieved with font data shift commands ?
https://xantorohara.github.io/led-matrix-editor/#
I think i recall i can put that in progmem somehow ?
Scrolling is i guess easily achieved with font data shift commands ?
Yes, it's probably best to use the ProgMem data type ByteTableData. For example,FFMan wrote:I think i recall i can put that in progmem somehow ?
Code: Select all
Dim byChrs as ByteTableData ({
'0
&B00111000, &B01000100, &B01000100, &B01000100, &B01000100, &B01000100, &B01000100, &B00111000
'1
&B00010000, &B00110000, &B00010000, &B00010000, &B00010000, &B00010000, &B00010000, &B00111000
'2
&B00111000, &B01000100, &B00000100, &B00000100, &B00001000, &B00010000, &B00100000, &B01111100
'3
&B00111000, &B01000100, &B00000100, &B00011000, &B00000100, &B00000100, &B01000100, &B00111000
'4
&B00000100, &B00001100, &B00010100, &B00100100, &B01000100, &B01111100, &B00000100, &B00000100
'5
&B01111100, &B01000000, &B01000000, &B01111000, &B00000100, &B00000100, &B01000100, &B00111000
'6
&B00111000, &B01000100, &B01000000, &B01111000, &B01000100, &B01000100, &B01000100, &B00111000
'7
&B01111100, &B00000100, &B00000100, &B00001000, &B00010000, &B00100000, &B00100000, &B00100000
'8
&B00111000, &B01000100, &B01000100, &B00111000, &B01000100, &B01000100, &B01000100, &B00111000
'9
&B00111000, &B01000100, &B01000100, &B01000100, &B00111100, &B00000100, &B01000100, &B00111000
})
Sub Main()
Dim i as Integer, j as Integer
For i = 1 to 10
For j = 1 to 8
Debug.Print "0x"; CStrHex(byChrs(j, i)); " ";
Next j
Debug.Print
Next i
End Sub
- Don Kinzer
thanks don - i used that and added in A-Z characters.
Question - when it come to scrolling text. Lets say I have a 4 character display and a message like "Hello World" (keeping it traditional) that i want to scroll.
Scrolling is simply achieved by shifting each bit pattern 1 bit at a time and re-displaying.
So I've created a 50 byte (x 8 for each row) message buffer and written a sub to load the bit patterns for my message.
There are a couple of options to achieve scrolling:-
1) i write a routine that always displays the first 4 characters of my buffer, and i write a routine that shuffles all the bits across the buffer, and then re-displays. Achievable but a bit of a pain as bits will traverse from one array element to another and it doesn't feel very efficient though i daresay there is time as the scrolling needs to be slow enough to be readable,
2) my display routine simply has a startbit parameter and it reads from that point in the buffer forwards for 4 characters
both of these routines would be much easier if there was a way of addressing the bits as a continuous stream rather than buffer element 5, bit 3 etc
I can write a routine to abstract the byte array boundaries and return say bit 245, but again it feels inefficent as calls will be numerous to write 4 characters.
I'm thinking there must be a better approach but I can't think of it - any suggestions welcome.
Question - when it come to scrolling text. Lets say I have a 4 character display and a message like "Hello World" (keeping it traditional) that i want to scroll.
Scrolling is simply achieved by shifting each bit pattern 1 bit at a time and re-displaying.
So I've created a 50 byte (x 8 for each row) message buffer and written a sub to load the bit patterns for my message.
There are a couple of options to achieve scrolling:-
1) i write a routine that always displays the first 4 characters of my buffer, and i write a routine that shuffles all the bits across the buffer, and then re-displays. Achievable but a bit of a pain as bits will traverse from one array element to another and it doesn't feel very efficient though i daresay there is time as the scrolling needs to be slow enough to be readable,
2) my display routine simply has a startbit parameter and it reads from that point in the buffer forwards for 4 characters
both of these routines would be much easier if there was a way of addressing the bits as a continuous stream rather than buffer element 5, bit 3 etc
I can write a routine to abstract the byte array boundaries and return say bit 245, but again it feels inefficent as calls will be numerous to write 4 characters.
I'm thinking there must be a better approach but I can't think of it - any suggestions welcome.
My impression was that the character data is given as dot columns, i.e. each byte represents the on/off state of a column of dots on the display. If that is true and your message buffer essentially amounts to the dot columns of the message, the scrolling should be achievable by advancing one or more dot columns (bytes) in the message buffer for each scroll interval. Am I missing something?FFMan wrote:Scrolling is simply achieved by shifting each bit pattern 1 bit at a time and re-displaying.
- Don Kinzer
the data is actually dot rows (but the principal is the same) with each byte containing 8 bits that indicate what led should do. each character is 8 bytes so the 8x8 matrix is covered.
> the scrolling should be achievable by advancing one or more dot columns (bytes)
If you shift bytes, the characters will jump whole display segments, rather 1 column at a time and the desired smooth scroll.
What would be useful is some sort of GetBit that can operate on a data stream 400 bits wide efficiently. I can code this but i was wondering if there is a more efficient way like Rampeek that returns a bit.
> the scrolling should be achievable by advancing one or more dot columns (bytes)
If you shift bytes, the characters will jump whole display segments, rather 1 column at a time and the desired smooth scroll.
What would be useful is some sort of GetBit that can operate on a data stream 400 bits wide efficiently. I can code this but i was wondering if there is a more efficient way like Rampeek that returns a bit.