📄 cs5550.txt
字号:
;***********************************************************
;This is basic programs for CS5550A EVALUATE-BOARD
;condition:12MHz,CPU[51]
;Write by RockChen on 2002.1.17 in HoneStar
;***********************************************************
cs equ p0.3
sdi equ p0.0
sdo equ p0.2
sclk equ p0.1
int equ p3.2
;byte=======================================================
tempa equ 30h
temph equ 31h
tempm equ 32h
templ equ 33h
;***********************************************************
org 00h
ljmp start
org 30h
start:
clr cs
lcall init5550a
main:
mov a,#0ah ;read cc
lcall writebyte ;send command
lcall readbyte ;receive bytes high byte first
mov temph,a
lcall readbyte
mov tempm,a
lcall readbyte
mov templ,a ;24位3字节
ljmp main
;***********************************************************
;===========================================================
;In:
;Out:
;Use: r1,2sp
;Note:
;===========================================================
init5550a:
clr ex0 ;关闭51外部中断0
setb sdi
clr sclk
mov r1,#63
setb cs
clr cs
init541: setb sclk;发送7个SYNC1和1个SYNC0
clr sclk
djnz r1,init541
clr sdi
setb sclk
clr sclk ;初始化串口
mov a,#0e8h ;命令字0e8h 执行连续转换
lcall writeByte ;
setb ex0
ret
;===========================================================
;In: none
;Out: a
;Use: a,r1
;Note: read one byte[a] from cs5550a
;===========================================================
readbyte:
mov r1,#08 ;8位
setb sdi ;set sdi to avoid inadvertent
readbyte1:
mov c,sdo ;read msb first
rlc a
setb sclk
nop
clr sclk
djnz r1,readbyte1
ret
;===========================================================
;In: a
;Out: none
;Use: a,r1
;Note: send one byte[a] to cs5550a
;===========================================================
writebyte:
mov r1,#08 ;8位命令字
clr sclk
writebyte1:
rlc a ;移位发送
mov sdi,c
nop
setb sclk
nop
clr sclk
djnz r1,writebyte1
setb sdi ;空命令
ret
;***********************************************************
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -