Howdy, Palm,
I don't know how easy it is to use with an 08M, considering that you're going to be doing stuff other than sending data to the display. Give it a try and see if you run out of program space.
I can't find the code for the project where I actually used a 7219... it was a while ago. But I found the following test routine I wrote for the 18X. As you see, there's not much to the 7219 interface code, so it shouldn't occupy too much of your program memory.
Good luck!
Tom
<code><pre><font size=2 face='Courier'>
;----------------------------------------------------------
;
; Max7219 Test
;
; Tests high performance 7219 write method
; using b1 and b0 bit aliases
;
;----------------------------------------------------------
; Outputs to Max7219
symbol DIN = 0
symbol CLK = 1
symbol CS = 2
; Registers
symbol Opcode = b1 ; used as bit15:b8
symbol Value = b0 ; used as bit7:bit0
symbol Temp = b2
symbol DPMask = b3 ; decimal point mask
; 7219
symbol DCodeReg = $09
symbol DCodeVal = $ff ; B decode for all digits
symbol ScanReg = $0b
symbol ScanVal = $03 ; 4 digits
symbol IntenReg = $0a
symbol IntenVal = $06 ; 17/32
symbol ShutReg = $0c
symbol ShutVal = $01 ; No shutdown
main:
pause 1000 ; Wait for 7219 to power up
gosub Init7219
Temp = 0
DPMask = 0
m1:
Opcode = $01 ; First digit
Value = Temp | DPMask
gosub Send7219
inc Temp
if Temp > 9 then
Temp = 0
DPMask = %10000000 - DPMask ; Toggle decimal point flag
endif
goto m1
end
;---------------------------------
Init7219:
Opcode = DCodeReg
Value = DCodeVal
gosub Send7219
Opcode = ScanReg
Value = ScanVal
gosub Send7219
Opcode = IntenReg
Value = IntenVal
gosub Send7219
Opcode = ShutReg
Value = ShutVal
gosub Send7219
return
;---------------------------------
Send7219:
; Send opcode in b1, data in b0 to 7219
low CS
pin0 = bit15
pulsout CLK,1
pin0 = bit14
pulsout CLK,1
pin0 = bit13
pulsout CLK,1
pin0 = bit12
pulsout CLK,1
pin0 = bit11
pulsout CLK,1
pin0 = bit10
pulsout CLK,1
pin0 = bit9
pulsout CLK,1
pin0 = bit8
pulsout CLK,1
pin0 = bit7
pulsout CLK,1
pin0 = bit6
pulsout CLK,1
pin0 = bit5
pulsout CLK,1
pin0 = bit4
pulsout CLK,1
pin0 = bit3
pulsout CLK,1
pin0 = bit2
pulsout CLK,1
pin0 = bit1
pulsout CLK,1
pin0 = bit0
pulsout CLK,1
high CS
return
</font></pre></code>
Edited by - Tom2000 on 08/07/2007 18:43:48