標(biāo)題:
ARM讀取DS1302匯編程序
[打印本頁]
作者:
51黑小牛
時(shí)間:
2016-4-10 17:33
標(biāo)題:
ARM讀取DS1302匯編程序
GPACON EQU 0x56000000
GPADAT EQU 0x56000004
GPAUP EQU 0x56000008
EXPORT xmain
AREA Init,CODE,READONLY
ENTRY
xmain
ldr r0,=GPACON
ldr r1,[r0]
bic r1,r1,#0xff
bic r1,r1,#0x1f00
str r1,[r0] ;A=out
mov r6,#0x53
BL R1302
B xmain
;====================================
R1302 mov r7,#0
ldr r0,=GPADAT
ldr r1,[r0]
ORR r1,r1,#0x400
str r1,[r0] ;rst=1
;========
lp and r8,r6,#0x01
cmp r8,#0x01
bne dd2
orr r1,r1,#0x1000
B dd1
dd2 bic r1,r1,#0x1000
dd1 str r1,[r0]
ror r6,r6,#1
orr r1,r1,#0x800
str r1,[r0]
add r7,r7,#1
bic r1,r1,#0x800
str r1,[r0]
cmp r7,#8
bne lp
;========
ldr r0,=GPACON
ldr r1,[r0]
orr r1,r1,#0x1000
str r1,[r0]
mov r7,#0
mov r6,#0
mov r8,#0
ldr r0,=GPADAT
gg1 ldr r8,[r0]
and r8,r8,#0x1000
cmp r8,#0x1000
bne gg2
orr r6,r6,#1
gg2 LSL r6,r6,#1
orr r1,r1,#0x800
nop
bic r1,r1,#0x800
add r7,r7,#1
cmp r7,#8
bne gg1
mov pc,lr
END
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1