MAX7219 With 7-segment (+dp) display

Post and discuss new components that you have created.
Post Reply
mnfisher
Valued Contributor
Posts: 1703
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 146 times
Been thanked: 794 times

MAX7219 With 7-segment (+dp) display

Post by mnfisher »

There is probably something similar in the FC component catalogue... For a little fun - I did a MAX7219 component - I have an eight digit display - but the number of digits can be changed - although the modules can be linked I haven't allowed for that here - max number of digits is 8.

It allows digits 0..9, A,b,C,d,E,F,H,L,o,P,U,_,-, ' ' (space) and decimal point(s) - output can be displayed left or right justified (also a property - my module has digit '1' at the right and '8' at the left)

You can also adjust brightness and put the display into a sleep mode (although the current draw doesn't change much)

I've included the source - if anyone would like to add features (simulation - there is a minimum (ie none)) or centre justification (for example)

Macros:
Initialise(brightness)
DisplayString(string, justify)
DisplayInt(uint, justify) (a version allowing a signed int might be nice?)
DisplayHex(uint, justify)
DisplayFloat(fp_number, justify)
SetBrightness(0..15)
Power(on = true)

It uses SPI to communicate with the module - and needs a (dummy) MISO to compile.
On a PIC18F46K80 with 20MHz crystal - SPI in software mode at FOsc/4 worked nicely - I couldn't test hardware mode (on my homemade dev board) - I only added a few header pins.

Note that the MAX7219 has a (basic) character set built in - but I use my own lookup here to allow the extra characters (other than 0..9)

Tested with v10 and v11.

Here captured displaying 1.2345 (right justified)
board_lcd.jpg
board_lcd.jpg (155.58 KiB) Viewed 55 times
Eeew - where's a keyboard sanitiser when you need one!

Martin
Attachments
MAX72197Seg.fcpx
(5.23 KiB) Downloaded 8 times
max7219.fcfx
(38.63 KiB) Downloaded 8 times
max7219_test.fcfx
(11.65 KiB) Downloaded 9 times

Post Reply