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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/11/02 21:40
Read: times


 
#20709 - RE: interfacing max7219 with AT 89C52
Here is Working code, it was written in rigel assembler :
; max-7219
; author: Goran IGIC
; 11-13-2000
; variable definitions
; decode-mode register
decode equ 09h
bcd012 equ 07h
nobcd equ 00h
; intensity register
intens equ 0ah
full equ 0fh
; scan limit register
limit equ 0bh
digit012 equ 02h
; shudown register
shutdn equ 0ch
down equ 00h
normal equ 01h
; display test register
test equ 0fh
yes equ 01h
no equ 00h
;digit
;dig0 equ 01h
dig0 equ 03h
dig1 equ 02h
;dig2 equ 03h
dig2 equ 01h
;---------------------------------
SgmDY segment code
;---------------------------------
public MaxInit
public MaxWrite
public delay
;---------------------------------
rseg SgmDY
;---------------------------------
; send address and data to LED
; a <- address
; b <- data
MaxWrite:
setb load
lcall SendByte
xch a,b
lcall SendByte
clr load
nop
nop
setb load
ret
; send byte from acc to LED
SendByte:
push i
mov i,#8
l10:
jb acc.7,l20
clr ddata
sjmp l30
l20:
setb ddata
l30:
setb clk
nop
nop
clr clk
rl a
djnz i,l10
pop i
ret
; i n i t i a l i z a t i o n
MaxInit:
mov a,#decode
mov b,#bcd012
lcall MaxWrite
;
mov a,#intens
mov b,#full
lcall MaxWrite
;
mov a,#limit
mov b,#digit012
lcall MaxWrite
Go:
;
mov a,#shutdn
mov b,#normal
lcall MaxWrite
;
mov a,#test
mov b,#yes
lcall MaxWrite
;
setb wd
clr wd
;
lcall delay
;
mov a,#test
mov b,#no
lcall MaxWrite
;
lcall clear
lcall delay
;
ret
;------clear-----------------------
clear:
mov a,#dig0
mov b,#0ffh
lcall MaxWrite
mov a,#dig1
mov b,#0ffh
lcall MaxWrite
lcall MaxWrite
mov a,#dig2
mov b,#0ffh
lcall MaxWrite
ret
;
delay:
;init{------------------------------
push 5
push 6
push 7
;----------------------------------}
mov r5,#05h
rot0:
mov r7,#0ffh
rot1:
mov r6,#0ffh
rot2:
djnz r6,rot2
djnz r7,rot1
djnz r5,rot0
;restore{--------------------------
pop 7
pop 6
pop 5
;----------------------------------}
ret


List of 7 messages in thread
TopicAuthorDate
interfacing max7219 with AT 89C52            01/01/70 00:00      
RE: interfacing max7219 with AT 89C52            01/01/70 00:00      
RE: interfacing max7219 with AT 89C52            01/01/70 00:00      
RE: interfacing max7219 with AT 89C52            01/01/70 00:00      
RE: interfacing max7219 with AT 89C52            01/01/70 00:00      
RE: interfacing max7219 with AT 89C52            01/01/70 00:00      
RE: interfacing max7219 with AT 89C52            01/01/70 00:00      

Back to Subject List