emc单片机对ak2345读写操作
INDI EQU 0X0
RTCC EQU 0X1
PC EQU 0X2
STATUS EQU 0X3
FSR EQU 0X4
P5 EQU 0X5
P6 EQU 0X6
RC EQU 0X7
E EQU 0
RS EQU 1
INF EQU 0X0F
YS_1 EQU 0X10
YS_2 EQU 0X11
YS_3 EQU 0X12
STACK_S EQU 0X13
STACK_A EQU 0X14
DATA1 EQU 0X15
KWRITE EQU 0X16
YWRITE EQU 0X17
BYTE EQU 0X18
CNSL EQU 0X19
RCNLE EQU 0X1A
FM_1 EQU 0X1B
FM_2 EQU 0X1C
FM_3 EQU 0X1D
FM_4 EQU 0X1E
FM_5 EQU 0X20
FM_6 EQU 0X21
YS2 EQU 0X22
;STB为P6,3 .SDATA/DCS为P6,1 。SCLK 为P6,2 DETOUT 为P6,0。
ORG 0
JMP MAIN
ORG 8
MOV STACK_A,A
SWAP STACK_A
BC 0X0F,0
SWAP STACK_A
MOV A,STACK_A
RETI
SSU:
BC P6,2
BC P6,3
MOV A,@7
MOV YS_1,A
SHI:
BC P6,2
RLC FM_1
JBS 0X3,0
JMP FG
BS P6,1
JMP FD
FG:
BC P6,1
FD:
BS P6,2
BC P6,1
DJZ YS_1
JMP SHI
BC P6,2
JBS FM_1,7
JMP FG_1
BC P6,1
JMP FD_1
FG_1:
BC P6,1
FD_1:
BS P6,2
Bs P6,1
BS P6,3
BC P6,3
BC P6,2
BS P6,2
RET
YS:
MOV A,@200
MOV YS_2,A
KI:
MOV A,@200
MOV YS_3,A
KW:
DJZ YS_3
JMP KW
DJZ YS_2
JMP KI
RET
MAIN:
MOV A,@0X0
IOW 0X0E
MOV A,@0B11000000
CONTW
CLR 0X0F
MOV A,@0X01
IOW 0X0F
ENI
MOV A,@0X10
MOV 0X4,A
LOPKN:
MOV A,@0
MOV 0X0,A
JBS 0X4,6
JMP KOL
JMP KIL
KOL:
NOP
INC 0X4
JMP LOPKN
KIL:
BS 0X4,6
MOV A,@0B00000000
IOW P6
IOW P5
CLR P5
CLR P6
COM P6
MOV A,@0B00111111 ;SET A
MOV FM_1,A
CALL SSU
MOV A,@0B00000000
MOV FM_1,A
CALL SSU
MOV A,@0B01000000
MOV FM_1,A
CALL SSU
MOV A,@0B01010000
MOV FM_1,A
CALL SSU
MOV A,@0B01100000
MOV FM_1,A
CALL SSU
MOV A,FM_2
MOV A,@0B01110000
MOV FM_1,A
CALL SSU
CALL YS
CALL YS ;YS>10M
MOV A,@0B01000010
MOV FM_1,A
CALL SSU
MOV A,@0B01010110
MOV FM_1,A
CALL SSU
MOV A,@0B01100111
MOV FM_1,A
CALL SSU
MOV A,FM_2
MOV A,@0B01110001
MOV FM_1,A
CALL SSU
MOV A,@0B10000110
MOV FM_1,A
CALL SSU
CALL YS ;>0.8MS
MOV A,@0B00111110
MOV FM_1,A
CALL SSU
MOV A,@0B11100001 ;250.3
MOV FM_1,A
CALL SSU
CALL YS
CALL YS
CALL YS
MOV A,@0B00101000
MOV FM_1,A
CALL SSU
MOV A,@0B11100001 ;250.3
MOV FM_1,A
CALL SSU
CALL YS
LOP:
CALL YS
NOP
NOP
NOP
CALL YS
NOP
NOP
NOP
JMP LOP
EOP
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。