MAX7221 startup and display problems

LED Maestro

Senior Member
Hey, so I am reluctantly asking yet another question after trawling the forum, and the rest of the internet, for any hints on what I'm about to ask, for what seems like an eternity.

I can't, for the life of me, get my MAX7221 to display, sequentially, the numbers 0-9. I am running it off of a 28X1 with the appropriate connections in place as per the code below which I came across whilst on here.

This is my first venture into SPI comms and I've read, re-read and re-re-read the datasheet for the MAX7221/7219 many many times and I'm still confused I must admit.

The code was written for the 7219 but as that and the 7211 are virtually identical, I assumed it would work as is but apparently not.

As always, any help is appreciated.
Thanks

Code:
#Picaxe28x1

symbol dout = b.1
symbol cs =   b.2
symbol cl =   b.3

symbol outreg = b1
symbol outval = b0
symbol outword = w0

symbol bitcounter = b2

symbol tths = b3 
symbol thos = b4 
symbol hnds = b5 
symbol tens = b6 
symbol ones = b7 
symbol counter = b8 

symbol n0 = %01111110
symbol n1 = %00110000
symbol n2 = %01101101
symbol n3 = %01111001
symbol n4 = %00110011
symbol n5 = %01011011
symbol n6 = %01011111
symbol n7 = %01110000
symbol n8 = %01111111
symbol n9 = %01111011

symbol decode = 9
symbol brite = 10
symbol scan = 11
symbol display = 12

pause 500

outreg = decode
outval = 0
gosub shifter

pause 500

outreg = brite
outval = 10
gosub shifter

pause 500

outreg = scan
outval = 0
gosub shifter

pause 500

outreg = display
outval = 1
gosub shifter

pause 500 


main:

for counter = 0 to 9 

lookup counter, (n0,n1,n2,n3,n4,n5,n6,n7,n8,n9), outval
outreg = 1
gosub shifter
pause 100
next counter 
goto main

shifter:
low cs
for bitcounter = 0 to 15
if bit15 = 1 then
high dout
else
low dout
endif
high cl
low cl
outword = outword * 2
next bitcounter
high cs
low cs
return
 

premelec

Senior Member
There is a very good tutorial by Westaust55 in pdf format that is easier to understand than the data sheet directly - sorry I don't have immediate link but search or eclectic should produce it... Iv'e only worked with 08M2 coding... for 7219...
 

LED Maestro

Senior Member
Thanks for your reply. I didn't come across that in my rambles through the forum yesterday. I will have another look though. Thank you
 

xtech007

Senior Member
more details..

Welcome!
I also used a 28x1 and max7219 to experiment and add to the picaxe learning curve.

Couple of questions:
What is the display?
7 segment display, 8x8 led display ?
Common cathode, common anode?
More details, the better the forum might help!
I used an 8x8 display!
 

LED Maestro

Senior Member
Hi thanks for the replies. And my apologies, it's a 7 seg CC display. I will take a look at that link, thanks for that
 
Top