led.s

来自「该驱动程序是针对2410开发板的LED灯的驱动」· S 代码 · 共 74 行

S
74
字号
/* * Name	: led_on.s * Disc	: simple led example * 2007-07-30 by Qingmin Liu */@ register address.equ WTCON,	0x53000000.equ GPFCON,	0x56000050@ offset value.equ oGPFDAT,	0x04@ macro defination LED_ON@ you should initial IO pins about leds in order to use this macro.macro LED_ON led_value	ldr r1, =\led_value	str r1, [r0, #oGPFDAT]	bl delay.endm.text.global _start	@ specified by GNU ld. Here is		@ ultimately 0x00000000,and you		@ can fine this in Makefile._start:	@ disable watch dog timer	@ otherwise mcu will reset at fixed interval, and	@ you will find led on and off in abnormal way.	mov r0, #WTCON	mov r1, #0x00	str r1, [r0]	@ initial IO pins: GPF[7:4]	@ please read datasheet	ldr r0, =GPFCON	ldr r1, =0x5500	str r1, [r0]	@ start to light the leds	@ led on when low voltage1:	LED_ON 0xd0	LED_ON 0x70	LED_ON 0xe0	LED_ON 0xb0		b 1b	@ meaningless but readablestop:	b stop@@ SUB Routine@@ not accurately, but good effectdelay:	mov r2, #0x100002:	subs r2, r2, #0x1	bne 2b	mov pc, lr.end@ "1" and "2" are local symbols. This is supported by Gnu as.@ If you want to learn more, follow below:@    (1) $ man as@    (2) read "using as -- the GNU assembler"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?