1 APB总线
core8051s内核支持APB3总线,APB writebuffer 为{XWB3, XWB2, XWB1, ACC};
写访问
对FC00以上地址写值,即表示APB写操作,值为(XWB3, XWB2, XWB1, ACC)。
MOV DPTR, #0FC20H
MOVX @DPTR, A
读访问
MOV DPTR, #0FC20H
MOVX A, @DPTR即可更新 (XWB3, XWB2, XWB1, ACC)。
2 APB汇编示例
FC00-FFFFH空间映射了1个1K的SRAM,通过APB总线来读写。
apb3.asm
XWB3 EQU 9CH
XWB2 EQU 9BH
XWB1 EQU 9AH
XRB3 EQU 9FH
XRB2 EQU 9EH
XRB1 EQU 9DH
main:
MOV R7, #0H
MOV DPTR, #0ff40H
MOV XWB3, #10H
MOV XWB2, #10H
MOV XWB1, #10H
MOV ACC, #10H
LOOP:
MOVX @DPTR, A ;apb write
MOVX A, @DPTR ; apb read
;display
MOV SBUF, XRB3
MOV SBUF, XRB2
MOV SBUF, XRB1
MOV SBUF, A
INC DPTR
INC R7
INC XWB3
INC XWB2
INC XWB1
MOV ACC, #10H
ADD A, R7
CJNE R7, #010H , LOOP
SJMP $
执行结果:
write op @f40: 10101010
read op @f40: 10101010
write op @f41: 11111111
read op @f41: 11111111
write op @f42: 12121212
read op @f42: 12121212
write op @f43: 13131313
read op @f43: 13131313
write op @f44: 14141414
read op @f44: 14141414
write op @f45: 15151515
read op @f45: 15151515
write op @f46: 16161616
read op @f46: 16161616
write op @f47: 17171717
read op @f47: 17171717
write op @f48: 18181818
read op @f48: 18181818
write op @f49: 19191919
read op @f49: 19191919
write op @f4a: 1a1a1a1a
read op @f4a: 1a1a1a1a
write op @f4b: 1b1b1b1b
read op @f4b: 1b1b1b1b
write op @f4c: 1c1c1c1c
read op @f4c: 1c1c1c1c
write op @f4d: 1d1d1d1d
read op @f4d: 1d1d1d1d
write op @f4e: 1e1e1e1e
read op @f4e: 1e1e1e1e
write op @f4f: 1f1f1f1f
read op @f4f: 1f1f1f1f