• LED点灯


    LED1

    1. .text
    2. .global _start
    3. _start:
    4. @1.RCC时钟使能GPIOE RCC_MP_AHB4ENSETR[4]->1
    5. ldr r0,=0x50000a28
    6. ldr r1,[r0]
    7. orr r1,r1,#(0x1<<4)
    8. str r1,[r0]
    9. @2.设置PE10为输出模式 GPIOE_MODER[21:20]->01
    10. ldr r0,=0x50006000
    11. ldr r1,[r0]
    12. bic r1,r1,#(0x3<<20)
    13. orr r1,r1,#(0x1<<20)
    14. str r1,[r0]
    15. @3.设置PE10为推挽输出 GPIOE_OTYPER[10]->0
    16. ldr r0,=0x50006004
    17. ldr r1,[r0]
    18. bic r1,r1,#(0x1<<10)
    19. str r1,[r0]
    20. @4.设置PE10为低速输出 GPIOE_OSPEEDR[21:20]->00
    21. ldr r0,=0x50006008
    22. ldr r1,[r0]
    23. bic r1,r1,#(0x3<<20)
    24. str r1,[r0]
    25. @5.设置PE10输出无上拉下拉 GPIOE_PUPDR[21:20]->00
    26. ldr r0,=0x5000600C
    27. ldr r1,[r0]
    28. bic r1,r1,#(0x3<<20)
    29. str r1,[r0]
    30. @6.控制PE10管脚输出高低电平 GPIOE_ODR[10]
    31. loop:
    32. bl led1_on
    33. bl delay
    34. bl led1_off
    35. bl delay
    36. b loop
    37. led1_on:
    38. ldr r0,=0x50006014
    39. ldr r1,[r0]
    40. orr r1,r1,#(0x1<<10)
    41. str r1,[r0]
    42. mov pc,lr
    43. led1_off:
    44. ldr r0,=0x50006014
    45. ldr r1,[r0]
    46. bic r1,r1,#(0x3<<10)
    47. str r1,[r0]
    48. mov pc,lr
    49. @封装汇编的延时函数
    50. delay:
    51. LDR R1,=0X10000000
    52. mm:
    53. cmp R1,#0
    54. SUBNE R1,R1,#1
    55. BNE mm
    56. mov pc,lr
    57. .end

    LED2

    1. .text
    2. .global _start
    3. _start:
    4. @1.RCC时钟使能GPIOE RCC_MP_AHB4ENSETR[5]->1
    5. ldr r0,=0x50000a28
    6. ldr r1,[r0]
    7. orr r1,r1,#(0x1<<5)
    8. str r1,[r0]
    9. @2.设置PE10为输出模式 GPIOE_MODER[21:20]->01
    10. ldr r0,=0x50007000
    11. ldr r1,[r0]
    12. bic r1,r1,#(0x3<<20)
    13. orr r1,r1,#(0x1<<20)
    14. str r1,[r0]
    15. @3.设置PE10为推挽输出 GPIOE_OTYPER[10]->0
    16. ldr r0,=0x50007004
    17. ldr r1,[r0]
    18. bic r1,r1,#(0x1<<10)
    19. str r1,[r0]
    20. @4.设置PE10为低速输出 GPIOE_OSPEEDR[21:20]->00
    21. ldr r0,=0x50007008
    22. ldr r1,[r0]
    23. bic r1,r1,#(0x3<<20)
    24. str r1,[r0]
    25. @5.设置PE10输出无上拉下拉 GPIOE_PUPDR[21:20]->00
    26. ldr r0,=0x5000700C
    27. ldr r1,[r0]
    28. bic r1,r1,#(0x3<<20)
    29. str r1,[r0]
    30. @6.控制PE10管脚输出高低电平 GPIOE_ODR[10]
    31. loop:
    32. bl led1_on
    33. bl delay
    34. bl led1_off
    35. bl delay
    36. b loop
    37. led1_on:
    38. ldr r0,=0x50007014
    39. ldr r1,[r0]
    40. orr r1,r1,#(0x1<<10)
    41. str r1,[r0]
    42. mov pc,lr
    43. led1_off:
    44. ldr r0,=0x50007014
    45. ldr r1,[r0]
    46. bic r1,r1,#(0x3<<10)
    47. str r1,[r0]
    48. mov pc,lr
    49. @封装汇编的延时函数
    50. delay:
    51. LDR R1,=0X10000000
    52. mm:
    53. cmp R1,#0
    54. SUBNE R1,R1,#1
    55. BNE mm
    56. mov pc,lr
    57. .end

    LED3

    1. .text
    2. .global _start
    3. _start:
    4. @1.RCC时钟使能GPIOE RCC_MP_AHB4ENSETR[4]->1
    5. ldr r0,=0x50000a28
    6. ldr r1,[r0]
    7. orr r1,r1,#(0x1<<4)
    8. str r1,[r0]
    9. @2.设置PE10为输出模式 GPIOE_MODER[17:16]->01
    10. ldr r0,=0x50006000
    11. ldr r1,[r0]
    12. bic r1,r1,#(0x3<<16)
    13. orr r1,r1,#(0x1<<16)
    14. str r1,[r0]
    15. @3.设置PE10为推挽输出 GPIOE_OTYPER[8]->0
    16. ldr r0,=0x50006004
    17. ldr r1,[r0]
    18. bic r1,r1,#(0x1<<8)
    19. str r1,[r0]
    20. @4.设置PE10为低速输出 GPIOE_OSPEEDR[17:16]->00
    21. ldr r0,=0x50006008
    22. ldr r1,[r0]
    23. bic r1,r1,#(0x3<<16)
    24. str r1,[r0]
    25. @5.设置PE10输出无上拉下拉 GPIOE_PUPDR[17:16]->00
    26. ldr r0,=0x5000600C
    27. ldr r1,[r0]
    28. bic r1,r1,#(0x3<<16)
    29. str r1,[r0]
    30. @6.控制PE10管脚输出高低电平 GPIOE_ODR[8]
    31. loop:
    32. bl led1_on
    33. bl delay
    34. bl led1_off
    35. bl delay
    36. b loop
    37. led1_on:
    38. ldr r0,=0x50006014
    39. ldr r1,[r0]
    40. orr r1,r1,#(0x1<<8)
    41. str r1,[r0]
    42. mov pc,lr
    43. led1_off:
    44. ldr r0,=0x50006014
    45. ldr r1,[r0]
    46. bic r1,r1,#(0x3<<8)
    47. str r1,[r0]
    48. mov pc,lr
    49. @封装汇编的延时函数
    50. delay:
    51. LDR R1,=0X10000000
    52. mm:
    53. cmp R1,#0
    54. SUBNE R1,R1,#1
    55. BNE mm
    56. mov pc,lr
    57. .end

    风扇

    1. .text
    2. .global _start
    3. _start:
    4. @1.RCC时钟使能GPIOE RCC_MP_AHB4ENSETR[4]->1
    5. ldr r0,=0x50000a28
    6. ldr r1,[r0]
    7. orr r1,r1,#(0x1<<4)
    8. str r1,[r0]
    9. @2.设置PE9为输出模式 GPIOE_MODER[19:18]->01
    10. ldr r0,=0x50006000
    11. ldr r1,[r0]
    12. bic r1,r1,#(0x3<<18)
    13. orr r1,r1,#(0x1<<18)
    14. str r1,[r0]
    15. @3.设置PE9为推挽输出 GPIOE_OTYPER[9]->0
    16. ldr r0,=0x50006004
    17. ldr r1,[r0]
    18. bic r1,r1,#(0x1<<9)
    19. str r1,[r0]
    20. @4.设置PE9为低速输出 GPIOE_OSPEEDR[19:18]->00
    21. ldr r0,=0x50006008
    22. ldr r1,[r0]
    23. bic r1,r1,#(0x3<<18)
    24. str r1,[r0]
    25. @5.设置PE9输出无上拉下拉 GPIOE_PUPDR[19:18]->00
    26. ldr r0,=0x5000600C
    27. ldr r1,[r0]
    28. bic r1,r1,#(0x3<<18)
    29. str r1,[r0]
    30. @6.控制PE9管脚输出高低电平 GPIOE_ODR[9]
    31. loop:
    32. bl led1_on
    33. bl delay
    34. bl led1_off
    35. bl delay
    36. b loop
    37. led1_on:
    38. ldr r0,=0x50006014
    39. ldr r1,[r0]
    40. orr r1,r1,#(0x1<<9)
    41. str r1,[r0]
    42. mov pc,lr
    43. led1_off:
    44. ldr r0,=0x50006014
    45. ldr r1,[r0]
    46. bic r1,r1,#(0x3<<9)
    47. str r1,[r0]
    48. mov pc,lr
    49. @封装汇编的延时函数
    50. delay:
    51. LDR R1,=0X10000000
    52. mm:
    53. cmp R1,#0
    54. SUBNE R1,R1,#1
    55. BNE mm
    56. mov pc,lr
    57. .end

    马达

    1. .text
    2. .global _start
    3. _start:
    4. @1.RCC时钟使能GPIOE RCC_MP_AHB4ENSETR[5]->1
    5. ldr r0,=0x50000a28
    6. ldr r1,[r0]
    7. orr r1,r1,#(0x1<<5)
    8. str r1,[r0]
    9. @2.设置PF6为输出模式 GPIOE_MODER[13,12]->01
    10. ldr r0,=0x50007000
    11. ldr r1,[r0]
    12. bic r1,r1,#(0x3<<12)
    13. orr r1,r1,#(0x1<<12)
    14. str r1,[r0]
    15. @3.设置PE10为推挽输出 GPIOE_OTYPER[6]->0
    16. ldr r0,=0x50007004
    17. ldr r1,[r0]
    18. bic r1,r1,#(0x1<<6)
    19. str r1,[r0]
    20. @4.设置PE10为低速输出 GPIOE_OSPEEDR[13,12]->00
    21. ldr r0,=0x50007008
    22. ldr r1,[r0]
    23. bic r1,r1,#(0x3<<12)
    24. str r1,[r0]
    25. @5.设置PE10输出无上拉下拉 GPIOE_PUPDR[13,12]->00
    26. ldr r0,=0x5000700C
    27. ldr r1,[r0]
    28. bic r1,r1,#(0x3<<12)
    29. str r1,[r0]
    30. @6.控制PE10管脚输出高低电平 GPIOE_ODR[10]
    31. loop:
    32. bl led1_on
    33. bl delay
    34. bl led1_off
    35. bl delay
    36. b loop
    37. led1_on:
    38. ldr r0,=0x50007014
    39. ldr r1,[r0]
    40. orr r1,r1,#(0x1<<6)
    41. str r1,[r0]
    42. mov pc,lr
    43. led1_off:
    44. ldr r0,=0x50007014
    45. ldr r1,[r0]
    46. bic r1,r1,#(0x3<<6)
    47. str r1,[r0]
    48. mov pc,lr
    49. @封装汇编的延时函数
    50. delay:
    51. LDR R1,=0X10000000
    52. mm:
    53. cmp R1,#0
    54. SUBNE R1,R1,#1
    55. BNE mm
    56. mov pc,lr
    57. .end

    蜂鸣器

    1. .text
    2. .global _start
    3. _start:
    4. @1.RCC时钟使能GPIOE RCC_MP_AHB4ENSETR[1]->1
    5. ldr r0,=0x50000a28
    6. ldr r1,[r0]
    7. orr r1,r1,#(0x1<<1)
    8. str r1,[r0]
    9. @2.设置PB6为输出模式 GPIOE_MODER[13:12]->01
    10. ldr r0,=0x50003000
    11. ldr r1,[r0]
    12. bic r1,r1,#(0x3<<12)
    13. orr r1,r1,#(0x1<<12)
    14. str r1,[r0]
    15. @3.设置PE10为推挽输出 GPIOE_OTYPER[6]->0
    16. ldr r0,=0x50003004
    17. ldr r1,[r0]
    18. bic r1,r1,#(0x1<<6)
    19. str r1,[r0]
    20. @4.设置PE10为低速输出 GPIOE_OSPEEDR[13:12]->00
    21. ldr r0,=0x50003008
    22. ldr r1,[r0]
    23. bic r1,r1,#(0x3<<12)
    24. str r1,[r0]
    25. @5.设置PE10输出无上拉下拉 GPIOE_PUPDR[13:12]->00
    26. ldr r0,=0x5000300C
    27. ldr r1,[r0]
    28. bic r1,r1,#(0x3<<12)
    29. str r1,[r0]
    30. @6.控制PE10管脚输出高低电平 GPIOE_ODR[6]
    31. loop:
    32. bl led1_on
    33. bl delay
    34. bl led1_off
    35. bl delay
    36. b loop
    37. led1_on:
    38. ldr r0,=0x50003014
    39. ldr r1,[r0]
    40. orr r1,r1,#(0x1<<6)
    41. str r1,[r0]
    42. mov pc,lr
    43. led1_off:
    44. ldr r0,=0x50003014
    45. ldr r1,[r0]
    46. bic r1,r1,#(0x3<<6)
    47. str r1,[r0]
    48. mov pc,lr
    49. @封装汇编的延时函数
    50. delay:
    51. LDR R1,=0X10000000
    52. mm:
    53. cmp R1,#0
    54. SUBNE R1,R1,#1
    55. BNE mm
    56. mov pc,lr
    57. .end

  • 相关阅读:
    wireshark 使用实践
    API 工程化分享
    springboot+vue+elementUI 广场舞团高校舞蹈社团管理系统-#毕业设计
    虚拟化不是区块链的发展道路,也不是真正意义上的区块链的呈现形式
    【调制解调】AM 调幅
    最好的前端框架
    022python - http请求(理论)
    极光推送Service
    [附源码]Python计算机毕业设计Django蛋糕购物商城
    关系数据库是如何工作的(8)
  • 原文地址:https://blog.csdn.net/weixin_53762703/article/details/134340355