arm点灯

.text 
.global _start
_start: 
	/**********LED1点灯**************/

	
RCC_INIT:
	LDR R0,=0X50000A28
	LDR R1,[R0]
	orr R1,R1,#(0x1<<4)
	orr R1,R1,#(0X1<<5)
	STR R1,[R0]
LED1_INIT:
	/**/
	LDR R0,=0X50006000
	LDR R1,[R0]
	and R1,R1,#(~(0X3<<20))
	orr R1,R1,#(0x1<<20)
	STR R1,[R0]
	/**/
	LDR R0,=0X50006004
	LDR R1,[R0]
	and R1,R1,#(~(0X1<<10))
	STR R1,[R0]
	/**/
	LDR R0,=0X50006008
	LDR R1,[R0]
	and R1,R1,#(~(0X11<<20))
	STR R1,[R0]
	/**/
	LDR R0,=0X5000600C
	LDR R1,[R0]
	and R1,R1,#(~(0X11<<20))
	STR R1,[R0]
LED2_INIT:
	/**/
	LDR R0,=0X50007000
	LDR R1,[R0]
	and R1,R1,#(~(0X3<<20))
	orr R1,R1,#(0x1<<20)
	STR R1,[R0]
	/**/
	LDR R0,=0X50007004
	LDR R1,[R0]
	and R1,R1,#(~(0X1<<10))
	STR R1,[R0]
	/**/
	LDR R0,=0X50007008
	LDR R1,[R0]
	and R1,R1,#(~(0X11<<20))
	STR R1,[R0]
	/**/
	LDR R0,=0X5000700C
	LDR R1,[R0]
	and R1,R1,#(~(0X11<<20))
	STR R1,[R0]
LED3_INIT:
	/**/
	LDR R0,=0X50006000
	LDR R1,[R0]
	and R1,R1,#(~(0X3<<16))
	orr R1,R1,#(0x1<<16)
	STR R1,[R0]
	/**/
	LDR R0,=0X50006004
	LDR R1,[R0]
	and R1,R1,#(~(0X1<<8))
	STR R1,[R0]
	/**/
	LDR R0,=0X50006008
	LDR R1,[R0]
	and R1,R1,#(~(0X11<<16))
	STR R1,[R0]
	/**/
	LDR R0,=0X5000600C
	LDR R1,[R0]
	and R1,R1,#(~(0X11<<16))
	STR R1,[R0]

main:
	bl LED1_ON
	bl delay_1s
	bl LED1_OFF
	bl delay_1s
	bl LED2_ON
	bl delay_1s
	bl LED2_OFF
	bl delay_1s
	bl LED3_ON
	bl delay_1s
	bl LED3_OFF
	bl delay_1s

	b main

LED1_ON:  
	LDR R0,=0X50006014
	LDR R1,[R0]
	orr R1,R1,#(0X1<<10)
	STR R1,[R0]
	mov pc, lr

LED1_OFF:
	LDR R0,=0X50006014
	LDR R1,[R0]
	and R1,R1,#(~(0X1<<10))
	STR R1,[R0]
	mov pc, lr
LED2_ON:  
	LDR R0,=0X50007014
	LDR R1,[R0]
	orr R1,R1,#(0X1<<10)
	STR R1,[R0]
	mov pc, lr

LED2_OFF:
	LDR R0,=0X50007014
	LDR R1,[R0]
	and R1,R1,#(~(0X1<<10))
	STR R1,[R0]
	mov pc, lr
LED3_ON:  
	LDR R0,=0X50006014
	LDR R1,[R0]
	orr R1,R1,#(0X1<<8)
	STR R1,[R0]
	mov pc, lr

LED3_OFF:
	LDR R0,=0X50006014
	LDR R1,[R0]
	and R1,R1,#(~(0X1<<8))
	STR R1,[R0]
	mov pc, lr

@ 大概1s的延时函数
delay_1s:
	mov r3, #0x10000000
	mm:
	cmp r3, #0
	subne r3, r3, #1
	bne mm
	mov pc, lr
	

.end

2.arm点灯_第1张图片

 

你可能感兴趣的:(java,前端,javascript)