max7219/SPI troubles.
Moderator: Benj
max7219/SPI troubles.
Hi there, I'm recently purchased a copy of Flowcode6 and I'm just finding my feet with it. Apologies for the newbie question.
I'm trying to communicate with an spi dual 7 segment dispay which uses the MAX7219 chip but with little success.
https://www.tindie.com/products/rajbex/ ... ay-yellow/
I'm pretty confident the connections to the device are correct. I have posted up my test file, I suspect I may be reading the tables wrong on the 7219 datasheet.
If anyone has the time to take a look, I'd be very grateful.
Thanks
Robin
I'm trying to communicate with an spi dual 7 segment dispay which uses the MAX7219 chip but with little success.
https://www.tindie.com/products/rajbex/ ... ay-yellow/
I'm pretty confident the connections to the device are correct. I have posted up my test file, I suspect I may be reading the tables wrong on the 7219 datasheet.
If anyone has the time to take a look, I'd be very grateful.
Thanks
Robin
- Attachments
-
- max7219test.fcfx
- (5.31 KiB) Downloaded 624 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: max7219/SPI troubles.
Hi Robin,
Looks like your on the right track.
If you want to use binary values then instead of writing this.
11111110
you need to add 0b to the start or the value will be processed as a decimal number and truncated to 8-bits.
0b11111110
You might also need small delays after the init and every time you raise the CS pin to complete your command. The main loop already has this and it might not be required.
Looks like your on the right track.
If you want to use binary values then instead of writing this.
11111110
you need to add 0b to the start or the value will be processed as a decimal number and truncated to 8-bits.
0b11111110
You might also need small delays after the init and every time you raise the CS pin to complete your command. The main loop already has this and it might not be required.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: max7219/SPI troubles.
Continuing the theme.
I use Arduino Nano and 8 X 7-seg. display with MAX7219.
Connecting the Arduino Nano, and 8 X 7-seg. display the picture.
I enclose a program written in Flowcode_6
I wonder why the program does not work?
What am I doing wrong?
Does anyone have a working program for the MAX7219 and 8 X 7-seg. displey? Just for test.
I use Arduino Nano and 8 X 7-seg. display with MAX7219.
Connecting the Arduino Nano, and 8 X 7-seg. display the picture.
I enclose a program written in Flowcode_6
I wonder why the program does not work?
What am I doing wrong?
Does anyone have a working program for the MAX7219 and 8 X 7-seg. displey? Just for test.
- Attachments
-
- Max7219_prikljucitev_na_Arduino_NANO.jpg
- (216.36 KiB) Downloaded 3307 times
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: max7219/SPI troubles.
Hi!
Code: Select all
initialize
Chip_Select := 1;
SPI_Init;
Chip_Select := 0;
SPI_Send_Char=0x0b;
SPI_Send_Char=0x07;
Chip_Select := 1;
Chip_Select := 0;
SPI_Send_Char=0x09;
SPI_Send_Char=0xff;
Chip_Select := 1;
Chip_Select := 0;
SPI_Send_Char=0x0c;
SPI_Send_Char=0x01;
Chip_Select := 1;
Chip_Select := 0;
SPI_Send_Char=0x0f;
SPI_Send_Char=0x00;
Chip_Select := 1;
Chip_Select := 0;
SPI_Send_Char=0x0a;
SPI_Send_Char=0x0f;
Chip_Select := 1;
//numbers
Chip_Select := 0;
SPI_Send_Char=0x01;//digit
SPI_Send_Char=0x01;//(number)
Chip_Select := 1;
Chip_Select := 0;
SPI_Send_Char=0x02;//digit
SPI_Send_Char=0x02;//(number)
Chip_Select := 1;
...and so on
Chip_Select := 0;
SPI_Send_Char=0x08;//digit
SPI_Send_Char=0x02;//(number)
Chip_Select := 1;
..-end
Re: max7219/SPI troubles.
STibor, thanks for the information.
I tried to Flowcode 6, but does not work. Absolutely nothing. What am I doing wrong?
I enclose a program Flowcode 6.
Stibor, nice project - https://www.youtube.com/watch?v=L_2jvbifOwk
How is this done? Arduino?
Thank you.
I tried to Flowcode 6, but does not work. Absolutely nothing. What am I doing wrong?
I enclose a program Flowcode 6.
Stibor, nice project - https://www.youtube.com/watch?v=L_2jvbifOwk
How is this done? Arduino?
Thank you.
- Attachments
-
- max7219test.fcfx
- (8.35 KiB) Downloaded 512 times
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: max7219/SPI troubles.
rradojko wrote: Stibor, nice project - https://www.youtube.com/watch?v=L_2jvbifOwk
How is this done? Arduino?
Hello!
Thanks!
No Arduino, with Pic18F6622 made.
I use Arduino development, final PIC microcontroller-based circuit.
Controller pcb:https://fbcdn-sphotos-a-a.akamaihd.net/ ... b1542b1ec7
Power PCB bottom side (on little Nch. dual FETs): https://fbcdn-sphotos-c-a.akamaihd.net/ ... 65f4754e6e
Power PCB top side(Nch power FETs for PWM):https://fbcdn-sphotos-c-a.akamaihd.net/ ... 054ef0751a
I attach an example.
I only have a dot matrix display with MAX7219, I can not test.
Proteus works well in the 7-segment display.
Last edited by STibor on Tue Nov 01, 2016 11:17 am, edited 1 time in total.
Re: max7219/SPI troubles.
Bravissssssimo, 7-segment 8 X works fine.STibor wrote:..............I attach an example.I only have a dot matrix display with MAX7219, I can not test.Proteus works well in the 7-segment display.
Thank you very much for example.
I am very happy to help

-
- Posts: 129
- Joined: Wed Jul 04, 2012 11:21 pm
- Location: Greece
- Has thanked: 51 times
- Been thanked: 19 times
Re: max7219/SPI troubles.
Hello all !
Great topic about MAX7219. I managed to flash the leds within a few minutes after i read this!
I have a question regarding displaying a float number on a three digit 7 segment Display.
For example at the moment i send 0b11111110 to obtain the desired character and it works totally fine for any character that i want!
If i have a float variable, how can i convert for example 12.3 value to binary and send it using SPI to MAX7219?
Is there any way of doing conversion of a number including the decimal place?
Thanks in advance!
George
Great topic about MAX7219. I managed to flash the leds within a few minutes after i read this!
I have a question regarding displaying a float number on a three digit 7 segment Display.
For example at the moment i send 0b11111110 to obtain the desired character and it works totally fine for any character that i want!
If i have a float variable, how can i convert for example 12.3 value to binary and send it using SPI to MAX7219?
Is there any way of doing conversion of a number including the decimal place?
Thanks in advance!
George
Last edited by George_B on Mon Oct 10, 2016 10:30 pm, edited 1 time in total.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: max7219/SPI troubles.
Hi George,
I would do something like this.
First copy the float into an integer variable. This will copy the whole part of the number leaving the decimal point. Then update the float variable so it only contains the real part of the number.
Then check if the number is greater than 100.
if it is then you can simply print out the three characters.
otherwise you need to collect the floating point based on the value.
int > 10 then decimal point is on character 2.
Otherwise decimal point is on character 1.
Hope this helps.
P.S. the % symbol is a modulus operator.
for example
234 % 10 = 4
234 % 100 = 34
I would do something like this.
First copy the float into an integer variable. This will copy the whole part of the number leaving the decimal point. Then update the float variable so it only contains the real part of the number.
Code: Select all
int = float
float = (float - int)
Code: Select all
int > 100
Code: Select all
char1 = int / 100
char2 = int % 100
char3 = int % 10
int > 10 then decimal point is on character 2.
Code: Select all
char1 = int / 10
char2 = int % 10
char3 = float * 10
Code: Select all
char1 = int
char2 = float * 10
char3 = (float * 100) % 10
P.S. the % symbol is a modulus operator.
for example
234 % 10 = 4
234 % 100 = 34
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 129
- Joined: Wed Jul 04, 2012 11:21 pm
- Location: Greece
- Has thanked: 51 times
- Been thanked: 19 times
Re: max7219/SPI troubles.
Hello Benj ! Thanks for your great help!
it is totally clear the way you describe the float to byte conversion.
I would like to know how to convert the number 1 for example into something like this 0b00110000 (D7D6D5D4D3D2D1D0 -> DP A B C D E F G) ??
it is totally clear the way you describe the float to byte conversion.
I would like to know how to convert the number 1 for example into something like this 0b00110000 (D7D6D5D4D3D2D1D0 -> DP A B C D E F G) ??
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: max7219/SPI troubles.
Hello,
To switch a number 0-9 into the binary value I would use a switch icon with all cases 0-9 ticked.
Then for say the 1 branch you can use the hard coded value 0b00110000.
To switch a number 0-9 into the binary value I would use a switch icon with all cases 0-9 ticked.
Then for say the 1 branch you can use the hard coded value 0b00110000.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 129
- Joined: Wed Jul 04, 2012 11:21 pm
- Location: Greece
- Has thanked: 51 times
- Been thanked: 19 times
Re: max7219/SPI troubles.
Hello all,
I followed Benj's suggestions. i tested the MAX 7219 and it works like a charm!
It is much more convenient to output the data as binary if you need to display characters or symbols that the BCD mode does not support.
It seems that i am not going to waste too many pins from my micro controller for those displays any more
I would prefer there was a similar chip for common anode led displays..
Thank you all and especially you Benj!
I followed Benj's suggestions. i tested the MAX 7219 and it works like a charm!
It is much more convenient to output the data as binary if you need to display characters or symbols that the BCD mode does not support.
It seems that i am not going to waste too many pins from my micro controller for those displays any more

I would prefer there was a similar chip for common anode led displays..
Thank you all and especially you Benj!