Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/02/02 07:24
Read: times


 
#21325 - max7219 with 8051: random results?
Hello all,

I'm trying to interface a max7219(8 digit, 7 segment, led driver) to a ds89c420(8051)
I've found some online code to help, including code from this message board.
I've also written my own and no matter what, it does not work like it should.
I'll try to explain what I'm doing to see if someone can maybe help out.
the max7219 uses a 3 pin serial interface, clk, cs, and data
basically, you need to send it 16 bits, pulsing clk in between them, when everything is done, bring cs high, than back low.

I've tried sending it every possible command, and like the data sheet says(and all the online code i could find), i send it the the decode register first, than the scan limit, intensity, then shutdown(bring it to normal mode) then start writing stuff..

My problem is that, no matter what code i send to it, all LEDs stay off till i send the shutdown. once i send that to it, which is 00001100 00000001, the display just displays random stuff(but always random segments on the same digit, have not gotten it to display segments on more than one digit at one time at all), and I can send any code to it, it does not change the LEDs that are turned on. If i turn 8051 off, than back on, it will pick some new random LEDs and just sit there once again.

To make sure the program was sending the right code, I made it echo the bit to the LCD panel thats hooked up to it as well, and the code matches what its supposed to be..

I've been messing with this thing for a week now, and It just doesn't work. I've even tried a different max7219, nothing changes.

like I said, i've looked everywhere, and done everythign I can think of, and this is all it does. Below is some of the code I'm using, maybe that will help...

thank you for even reading this massive post! greatly appreciated.

ddata equ p2.7
clk equ p2.6
load equ p2.5

ORG 30h
SJMP MAIN

MAIN:
CALL DELAY ;100ms
call Init
REPEAT:
cpl p2.4 ;LED to let me know prog is in this loop
CALL DELAY ;100ms
JMP REPEAT
RET


Init:
call holdon
mov A,#00001001b
mov B,#00000000b
lcall Write
...
more init commands just liek above, but for scan limit, and so on
...
ret

Write:
setb load
clr clk
clr ddata
clr load
lcall SendByte
xch a,b
lcall SendByte
setb load
call DELAY ;100ms delay, for testing
ret

SendByte:
push 0
mov r0,#8

l10:
jb acc.7,l20
clr ddata
sjmp l30

l20:
setb ddata

l30:
setb clk
call DELAY
clr clk
rl A
djnz r0,l10
pop 0
ret

List of 7 messages in thread
TopicAuthorDate
max7219 with 8051: random results?            01/01/70 00:00      
RE: max7219 with 8051: random results?            01/01/70 00:00      
RE: max7219 with 8051: random results?            01/01/70 00:00      
RE: max7219 with 8051: random results?            01/01/70 00:00      
RE: max7219 with 8051: random results?            01/01/70 00:00      
RE: max7219 with 8051: random results?            01/01/70 00:00      
RE: max7219 with 8051: random results?            01/01/70 00:00      

Back to Subject List