实验1&2。裸机下的LED和蜂鸣器实验
c文件的话直接把两个文件的内容合并下就行了,注意改改置0/1的地方 汇编的如下
ldr r1, =0x114000A0
ldr r0,[r1]
orr r0,r0,#0x1
str r0,[r1]
ldr r1, =0x11000100
ldr r0,[r1]
orr r0,r0,#0x1
str r0,[r1]
ldr r1, =0x11000060
ldr r0,[r1]
orr r0,r0,#0x10
str r0,[r1]
loop:
ldr r1, =0x114000A4
ldr r0,[r1];
orr r0,r0,#0x1;
str r0,[r1];
ldr r1, =0x11000104
ldr r0,[r1];
AND r0,r0,#0xfe
str r0,[r1]
ldr r1, =0x11000064
ldr r0,[r1];
orr r0,r0,#0x2
str r0,[r1]
ldr r2, =0x7ffffff
bl delay
ldr r1, =0x114000A4
ldr r0,[r1];
AND r0,r0,#0xfe
str r0,[r1]
ldr r1, =0x11000104
ldr r0,[r1];
orr r0,r0,#0x1;
str r0,[r1];
ldr r1, =0x11000064
ldr r0,[r1];
AND r0,r0,#0xfd;
str r0,[r1];
ldr r2, =0x7ffffff
bl delay
b loop
halt:
b halt
delay:
sub r2,r2,#0x01;
cmp r2,#0x0;
bne delay
mov pc ,lr
|