2.19 作业

2 .text

3 .global _start

4 _start:

5 /**********LED2点灯**************/

6

7

8 ldr r0,=0x50000A28

9 ldr r1,[r0]

10 ldr r2,=0x3<<4

11 orr r1,r2

12 str r1,[r0]

13

14

15 LED1_INIT:

16 /* ldr r0,=0x50000A28

17 ldr r1,[r0]

18 ldr r2,=0x3<<4

19 orr r1,r2

20 str r1,[r0]*/

21

22 ldr r0,=0x50006000

23 ldr r1,[r0]

24 ldr r2,=~(0x3<<20)

25 and r1,r2

26 ldr r2,=(0x01<<20)

27 orr r1,r2

28 str r1,[r0]

29

30 ldr r0,=0x50006004

31 ldr r1,[r0]

32 ldr r2,=~(0x1<<10)

33 and r1,r2

34 str r1,[r0]

35

36 ldr r0,=0x50006008

37 ldr r1,[r0]

38 ldr r2,=~(0x3<<20)

39 and r1,r2

40 str r1,[r0]

41

42 ldr r0,=0x5000600c

43 ldr r1,[r0]

44 ldr r2,=~(0x3<<20)

45 and r1,r2

46 str r1,[r0]

47

48

49

50

51 LED2_INIT:

52

53 /* ldr r0,=0x50000A28

54 ldr r1,[r0]

55 ldr r2,=0x3<<4

56 orr r1,r2

57 str r1,[r0]*/

58

59 ldr r0,=0x50007000

60 ldr r1,[r0]

61 ldr r2,=~(0x3<<20)

62 and r1,r2

63 ldr r2,=(0x01<<20)

64 orr r1,r2

65 str r1,[r0]

66

67 ldr r0,=0x50007004

68 ldr r1,[r0]

69 ldr r2,=~(0x1<<10)

70 and r1,r2

71 str r1,[r0]

72

73 ldr r0,=0x50007008

74 ldr r1,[r0]

75 ldr r2,=~(0x3<<20)

76 and r1,r2

77 str r1,[r0]

78

79 ldr r0,=0x5000700c

80 ldr r1,[r0]

81 ldr r2,=~(0x3<<20)

82 and r1,r2

83 str r1,[r0]

84

85

86 LED3_INIT:

87

88 /* ldr r0,=0x50000A28

89 ldr r1,[r0]

90 ldr r2,=0x3<<4

91 orr r1,r2

92 str r1,[r0]*/

93

94 ldr r0,=0x50006000

95 ldr r1,[r0]

96 ldr r2,=~(0x3<<16)

97 and r1,r2

98 ldr r2,=(0x01<<16)

99 orr r1,r2

100 str r1,[r0]

101

102 ldr r0,=0x50006004

103 ldr r1,[r0]

104 ldr r2,=~(0x1<<8)

105 and r1,r2

106 str r1,[r0]

107

108 ldr r0,=0x50006008

109 ldr r1,[r0]

110 ldr r2,=~(0x3<<16)

111 and r1,r2

112 str r1,[r0]

113

114 ldr r0,=0x5000600c

115 ldr r1,[r0]

116 ldr r2,=~(0x3<<16)

117 and r1,r2

118

119

120 loop:

121

122 bl LED_ON

123 bl delay_1s

124 bl LED_OFF

125 bl delay_1s

126 b loop

127

128

129 LED_ON:

130

131 ldr r0,=0x50006014

132 ldr r1,[r0]

133 ldr r2,=(0x1<<10)

134 orr r1,r2

135 str r1,[r0]

136

137 ldr r0,=0x50007014

138 ldr r1,[r0]

139 ldr r2,=(0x1<<10)

140 orr r1,r2

141 str r1,[r0]

142

143 ldr r0,=0x50006014

144 ldr r1,[r0]

145 ldr r2,=(0x1<<8)

146 orr r1,r2

147 str r1,[r0]

148

149 mov pc,lr

150

151 LED_OFF:

152

153 ldr r0,=0x50006014

154 ldr r1,[r0]

155 ldr r2,=~(0x1<<10)

156 and r1,r2

157 str r1,[r0]

158

159 ldr r0,=0x50007014

160 ldr r1,[r0]

161 ldr r2,=~(0x1<<10)

162 and r1,r2

163 str r1,[r0]

164

165 ldr r0,=0x50006014

166 ldr r1,[r0]

167 ldr r2,=~(0x1<<8)

168 and r1,r2

169 str r1,[r0]

170

171 mov pc,lr

172

173 @ 大概1s的延时函数

174 delay_1s:

175 mov r3, #0x10000000

176 mm:

177 cmp r3, #0

178 subne r3, r3, #1

179 bne mm

180 mov pc, lr

181

182

183 .end

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值