微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > GNU ARM汇编--(九)s3c2440的PWM

GNU ARM汇编--(九)s3c2440的PWM

时间:11-26 来源:互联网 点击:

  1. 90
  2. .equINTMSK,0x4A000008
  3. .equEINTPEND,0x560000a8
  4. .equSUBSRCPND,0x4a000018
  5. .equINTSUBMSK,0x4a00001c
  6. .equSRCPND,0X4A000000
  7. .equINTPND,0X4A000010
  8. .equGPHCON,0x56000070
  9. .equGPHDAT,0x56000074
  10. .equGPB5_out,(1<(5*2))
  11. .equGPB6_out,(1<(6*2))
  12. .equGPB7_out,(1<(7*2))
  13. .equGPB8_out,(1<(8*2))
  14. .equGPBVALUE,(GPB5_out|GPB6_out|GPB7_out|GPB8_out)
  15. .equLOCKTIME,0x4c000000
  16. .equMPLLCON,0x4c000004
  17. .equUPLLCON,0x4c000008
  18. .equM_Mdiv,92
  19. .equM_Pdiv,1
  20. .equM_Sdiv,1
  21. .equU_Mdiv,56
  22. .equU_Pdiv,2
  23. .equU_Sdiv,2
  24. .equCLKdivN,0x4c000014
  25. .equdivN_UPLL,0
  26. .equHdivN,1
  27. .equPdivN,1@FCLK:HCLK:PCLK=1:2:4
  28. .equWTCON,0x53000000
  29. .equPre_scaler,249
  30. .equwd_timer,1
  31. .equclock_select,00@316
  32. .equint_gen,1@开中断
  33. .equreset_enable,0@关掉重启信号
  34. .equWTDAT,0x53000004
  35. .equCount_reload,50000@定时器定为2SPCLK=100MPCLK/(Pre_scaler+1)/clock_select=100M/(249+1)/16=25k50000/25k=2s
  36. .equWTCNT,0x53000008
  37. .equCount,50000
  38. .equTCFG0,0x51000000
  39. .equPrescaler1,0x00@[15:8]Timer234
  40. .equPrescaler0,249@[7:0]Timer01
  41. .equTCFG1,0x51000004
  42. .equDMA_MODE,0x0@[23:20]nodmachannal
  43. .equMUX0,0x2@[3:0]1/8
  44. @定时器输入时钟周期=PCLK/(prescaler+1)/(dividervalue)
  45. @clk=100M/(249+1)/8=25k
  46. .equTCON,0x51000008
  47. .equDZ_eable,0@[4]关闭死区的操作
  48. .equauto_reload,1@[3]auto_reload
  49. .equinverter,1@[2]打开电平反转
  50. .equman_update,1@[1]手动更新
  51. .equclear_man_update,0
  52. .equstart,1@[0]开始
  53. .equstop,0@[0]停止
  54. .equTCNTB0,0x5100000c
  55. .equTCMPB0,0x51000010
  56. .equTCNTO0,0x51000014
  57. .equULCON0,0x50000000
  58. .equIR_MODE,0x0@[6]正常模式
  59. .equParity_Mode,0x0@[5:3]无校验位
  60. .equNum_of_stop_bit,0x0@[2]一个停止位
  61. .equWord_length,0b11@[1:0]8个数据位
  62. .equUCON0,0x50000004
  63. .equFCLK_Div,0@[15:12]时钟源选择用PCLK,所以这里用默认值
  64. .equClk_select,0b00@[11:10]时钟源选择使用PCLK
  65. .equTx_Int_Type,1@[9]中断请求类型为Level
  66. .equRx_Int_Type,0@1@[8]中断请求类型为Level
  67. .equRx_Timeout,0@[7]
  68. .equRx_Error_Stat_Int,1@[6]
  69. .equLoopback_Mode,0@[5]正常模式
  70. .equBreak_Sig,0@[4]不发送终止信号
  71. .equTx_Mode,0b01@[3:2]中断请求或轮循模式
  72. .equRx_Mode,0b01@[1:0]中断请求或轮循模式
  73. .equUFCON0,0x50000008
  74. .equTx_FIFO_Trig_Level,0b00@[7:6]
  75. .equRx_FIFO_Trig_Level,0b00@[5:4]
  76. .equTx_FIFO_Reset,0b0@[2]
  77. .equRx_FIFO_Reset,0b0@[1]
  78. .equFIFO_Enable,0b0@[0]非FIFO模式
  79. .equUMCON0,0x5000000C@这个寄存器可以不管的
  80. .equUTRSTAT0,0x50000010
  81. .equUERSTAT0,0x50000014
  82. .equUFSTAT0,0x50000018
  83. .equUMSTAT0,0x5000001C
  84. .equUTXH0,0x50000020@(L小端)
  85. .equURXH0,0x50000024@(L小端)
  86. .equUBRdiv0,0x50000028
  87. .equUBRdiv,0x35@PCLK=400M/4=100MUBRdiv=(int)(100M/115200/16)-1=53=0x35
  88. .globalBuzzer_Freq_Set
  89. .global_start
  90. _start:breset
  91. ldrpc,_undefined_instruction
  92. ldrpc,_software_interrupt
  93. ldrpc,_prefetch_abort
  94. ldrpc,_data_abort
  95. ldrpc,_not_used
  96. @birq
  97. ldrpc,_irq
  98. ldrpc,_fiq
  99. _undefined_instruction:.wordundefined_instruction
  100. _software_interrupt:.wordsoftware_interrupt
  101. _prefetch_abort:.wordprefetch_abort
  102. _data_abort:.worddata_abort
  103. _not_used:.wordnot_used
  104. _irq:.wordirq
  105. _fiq:.wordfiq
  106. .balignl16,0xdeadbeef
  107. reset:
  108. ldrr3,=WTCON
  109. movr4,#0x0
  110. strr4,[r3]@disablewatchdog
  111. ldrr0,=GPBCON
  112. ldrr1,=0x15400@这个时候暂不配置GPB0为TOUT0,这时候只是配置GPB0为TOUT0
  113. strr1,[r0]
  114. ldrr2,=GPBDAT
  115. ldrr1,=0x160
  116. strr1,[r2]
  117. blclock_setup
  118. bluart_init
  119. //bldelay
  120. msrcpsr_c,#0xd2@进入中断模式
  121. ldrsp,=3072@中断模式的栈指针定义
  122. msrcpsr_c,#0xd3@进入系统模式
  123. ldrsp,=4096@设置系统模式的栈指针
  124. @--------------------------------------------
  125. ldrr0,=GPBUP
  126. ldrr1,=0x03f0
  127. strr1,[r0]
  128. ldrr0,=GPFCON
  129. ldrr1,=0x2ea@0x2
  130. strr1,[r0]
  131. ldrr0,=EXTINT0
  132. @ldrr1,=0x8f888@0x0@0x8f888@~(7|(7<4)|(7<8)|(7<16))//低电平触发中断
  133. ldrr1,=0xafaaa@0x0@0x8f888//下降沿触发中断
  134. strr1,[r0]
  135. ldrr0,=EINTPEND
  136. ldrr1,=0xf0@0b10000
  137. strr1,[r0]
  138. ldrr0,=EINTMASK
  139. ldrr1,=0x00@0b00000
  140. strr1,[r0]
  141. ldrr0,=SRCPND
  142. ldrr1,=0x3ff@0x1@0b11111
  143. strr1,[r0]
  144. ldrr0,=SUBSRCPND
  145. ldrr1,=0x1<13
  146. strr1,[r0]
  147. ldrr0,=INTPND
  148. ldrr1,=0x3ff@0x1@0b11111
  149. strr1,[r0]
  150. ldrr0,=INTSUBMSK
  151. ldrr1,=0x0<13
  152. strr1,[r0]
  153. ldrr0,=INTMSK
  154. ldrr1,=0xfffff000@0b00000
  155. strr1,[r0]
  156. MRSr1,cpsr
  157. BICr1,r1,#0x80
  158. MSRcpsr_c,r1
  159. blmain
  160. irq:

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top