LEVEL9DAY4 ARM裸机开发-作业

1. 搭建开发环境,并编程实现4个led灯跑马灯显示。(请上传视频及源码)

1.1 源码:

.text
@ Led control project
@ 2020/10/26 by LSY

.equ GPX2CON,0x11000C40
.equ GPX2DAT,0x11000C44
.equ GPX1CON,0x11000C20
.equ GPX1DAT,0x11000C24
.equ GPF3CON,0x114001E0
.equ GPF3DAT,0x114001E4

loop:
	@set LED2 control = OUTPUT
	ldr r0,=GPX2CON
	ldr r1,[r0]
	bic r1,#0x0F000000
	orr r1,#0x10000000
	str r1,[r0]
	@set LED3 control = OUTPUT
	ldr r0,=GPX1CON
	ldr r1,[r0]
	bic r1,#0x0000000F
	orr r1,#0x00000001
	str r1,[r0]
	@set LED4 control = OUTPUT
	ldr r0,=GPF3CON
	ldr r1,[r0]
	bic r1,#0x000F0000
	orr r1,#0x00010000
	str r1,[r0]
	@set LED5 control = OUTPUT
	ldr r0,=GPF3CON
	ldr r1,[r0]
	bic r1,#0x00F00000
	orr r1,#0x00100000
	str r1,[r0]

	@open led2
	ldr r0,=GPX2DAT
	ldr r1,[r0]
	orr r1,#0x80
	str r1,[r0]
	@open led3
	ldr r0,=GPX1DAT
	ldr r1,[r0]
	orr r1,#0x01
	str r1,[r0]
	@open led4
	ldr r0,=GPF3DAT
	ldr r1,[r0]
	orr r1,#0x10
	str r1,[r0]
	@open led5
	ldr r0,=GPF3DAT
	ldr r1,[r0]
	orr r1,#0x20
	str r1,[r0]
	bl delay1s

	@close led2
	ldr r0,=GPX2DAT
	ldr r1,[r0]
	bic r1,#0x80
	str r1,[r0]
	@close led3
	ldr r0,=GPX1DAT
	ldr r1,[r0]
	bic r1,#0x01
	str r1,[r0]
	@close led4
	ldr r0,=GPF3DAT
	ldr r1,[r0]
	bic r1,#0x10
	str r1,[r0]
	@close led5
	ldr r0,=GPF3DAT
	ldr r1,[r0]
	bic r1,#0x20
	str r1,[r0]
	bl delay1s
	b loop

delay1s:
@wait 1s
	ldr sp, =space_top
	stmfd sp!,{r0-r12,lr}
	ldr r5,=0x3FFFFFF

delay_loop:
	sub r5,#1
	cmp r5,#0
	bne delay_loop
	ldmfd sp!,{r0-r12,pc}

.data
space_botton:
	.space 200
space_top:

.end

1.2 开发板效果展示:

1.3 代码效果展示: