main.txt
来自「STM32的ADC例程」· 文本 代码 · 共 554 行 · 第 1/2 页
TXT
554 行
;;;59 /* System clocks configuration ---------------------------------------------*/
;;;60 RCC_Configuration();
000004 f7fffffe BL RCC_Configuration
;;;61
;;;62 /* NVIC configuration ------------------------------------------------------*/
;;;63 NVIC_Configuration();
000008 f7fffffe BL NVIC_Configuration
;;;64
;;;65 /* GPIO configuration ------------------------------------------------------*/
;;;66 GPIO_Configuration();
00000c f7fffffe BL GPIO_Configuration
;;;67
;;;68 /* Configure the USART1 */
;;;69 USART_Configuration1();
000010 f7fffffe BL USART_Configuration1
;;;70
;;;71 printf("\r\n USART1 print AD_value -------------------------- \r\n");
000014 a036 ADR r0,|L5.240|
000016 f7fffffe BL __1printf
;;;72
;;;73 /* DMA channel1 configuration ----------------------------------------------*/
;;;74 DMA_DeInit(DMA1_Channel1);
00001a 4c43 LDR r4,|L5.296|
00001c 4620 MOV r0,r4
00001e f7fffffe BL DMA_DeInit
;;;75 DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address;
000022 4843 LDR r0,|L5.304|
000024 4941 LDR r1,|L5.300|
;;;76 DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&ADC_ConvertedValue;
000026 6001 STR r1,[r0,#0] ; DMA_InitStructure
000028 4942 LDR r1,|L5.308|
;;;77 DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
00002a 2500 MOVS r5,#0
;;;78 DMA_InitStructure.DMA_BufferSize = 1;
00002c 2601 MOVS r6,#1
;;;79 DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
00002e 1d02 ADDS r2,r0,#4
000030 c262 STM r2!,{r1,r5,r6}
;;;80 DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;
000032 6105 STR r5,[r0,#0x10] ; DMA_InitStructure
;;;81 DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
000034 15a1 ASRS r1,r4,#22
;;;82 DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
000036 e9c05105 STRD r5,r1,[r0,#0x14]
00003a 0089 LSLS r1,r1,#2
;;;83 DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
00003c 61c1 STR r1,[r0,#0x1c] ; DMA_InitStructure
00003e 2120 MOVS r1,#0x20
;;;84 DMA_InitStructure.DMA_Priority = DMA_Priority_High;
000040 6201 STR r1,[r0,#0x20] ; DMA_InitStructure
000042 0209 LSLS r1,r1,#8
;;;85 DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
;;;86 DMA_Init(DMA1_Channel1, &DMA_InitStructure);
000044 e9c01509 STRD r1,r5,[r0,#0x24]
000048 4601 MOV r1,r0
00004a 4620 MOV r0,r4
00004c f7fffffe BL DMA_Init
;;;87
;;;88 /* Enable DMA channel1 */
;;;89 DMA_Cmd(DMA1_Channel1, ENABLE);
000050 2101 MOVS r1,#1
000052 4620 MOV r0,r4
000054 f7fffffe BL DMA_Cmd
;;;90
;;;91 /* ADC1 configuration ------------------------------------------------------*/
;;;92 ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
000058 4835 LDR r0,|L5.304|
;;;93 ADC_InitStructure.ADC_ScanConvMode = ENABLE;
;;;94 ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
;;;95 ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
00005a f44f2160 MOV r1,#0xe0000
00005e 3814 SUBS r0,r0,#0x14 ;92
000060 6005 STR r5,[r0,#0] ;93 ; ADC_InitStructure
000062 7106 STRB r6,[r0,#4] ;93 ; ADC_InitStructure
000064 7146 STRB r6,[r0,#5] ;94 ; ADC_InitStructure
;;;96 ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
;;;97 ADC_InitStructure.ADC_NbrOfChannel = 1;
000066 e9c01502 STRD r1,r5,[r0,#8]
;;;98 ADC_Init(ADC1, &ADC_InitStructure);
00006a f8df80c0 LDR r8,|L5.300|
00006e 7406 STRB r6,[r0,#0x10] ;97 ; ADC_InitStructure
000070 4601 MOV r1,r0
000072 f1a8084c SUB r8,r8,#0x4c
000076 4640 MOV r0,r8
000078 f7fffffe BL ADC_Init
;;;99
;;;100 /* ADC1 regular channel14 configuration */
;;;101 ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 1, ADC_SampleTime_55Cycles5);
00007c 2305 MOVS r3,#5
00007e 2201 MOVS r2,#1
000080 210e MOVS r1,#0xe
000082 4640 MOV r0,r8
000084 f7fffffe BL ADC_RegularChannelConfig
;;;102
;;;103 /* Enable ADC1 DMA */
;;;104 ADC_DMACmd(ADC1, ENABLE);
000088 2101 MOVS r1,#1
00008a 4640 MOV r0,r8
00008c f7fffffe BL ADC_DMACmd
;;;105
;;;106 /* Enable ADC1 */
;;;107 ADC_Cmd(ADC1, ENABLE);
000090 2101 MOVS r1,#1
000092 4640 MOV r0,r8
000094 f7fffffe BL ADC_Cmd
;;;108
;;;109 /* Enable ADC1 reset calibaration register */
;;;110 ADC_ResetCalibration(ADC1);
000098 4640 MOV r0,r8
00009a f7fffffe BL ADC_ResetCalibration
|L5.158|
;;;111 /* Check the end of ADC1 reset calibration register */
;;;112 while(ADC_GetResetCalibrationStatus(ADC1));
00009e 4640 MOV r0,r8
0000a0 f7fffffe BL ADC_GetResetCalibrationStatus
0000a4 2800 CMP r0,#0
0000a6 d1fa BNE |L5.158|
;;;113
;;;114 /* Start ADC1 calibaration */
;;;115 ADC_StartCalibration(ADC1);
0000a8 4640 MOV r0,r8
0000aa f7fffffe BL ADC_StartCalibration
|L5.174|
;;;116 /* Check the end of ADC1 calibration */
;;;117 while(ADC_GetCalibrationStatus(ADC1));
0000ae 4640 MOV r0,r8
0000b0 f7fffffe BL ADC_GetCalibrationStatus
0000b4 2800 CMP r0,#0
0000b6 d1fa BNE |L5.174|
;;;118
;;;119 /* Start ADC1 Software Conversion */
;;;120 ADC_SoftwareStartConvCmd(ADC1, ENABLE);
0000b8 2101 MOVS r1,#1
0000ba 4640 MOV r0,r8
0000bc f7fffffe BL ADC_SoftwareStartConvCmd
0000c0 4c1c LDR r4,|L5.308|
0000c2 4f1d LDR r7,|L5.312|
0000c4 1ea4 SUBS r4,r4,#2
|L5.198|
;;;121
;;;122 while(1)
;;;123 {
;;;124 AD_value=ADC_GetConversionValue(ADC1);
0000c6 4640 MOV r0,r8
0000c8 f7fffffe BL ADC_GetConversionValue
;;;125 if (ticks++ >= 900000) { /* Set Clock1s to 1 every 1 second */
0000cc 6060 STR r0,[r4,#4] ; AD_value
0000ce 68a2 LDR r2,[r4,#8] ; ticks
0000d0 1c51 ADDS r1,r2,#1
0000d2 60a1 STR r1,[r4,#8] ; ticks
0000d4 42ba CMP r2,r7
0000d6 d302 BCC |L5.222|
;;;126 ticks = 0;
;;;127 Clock1s = 1;
0000d8 60a5 STR r5,[r4,#8] ; ticks
0000da 7026 STRB r6,[r4,#0] ; Clock1s
0000dc e002 B |L5.228|
|L5.222|
;;;128 }
;;;129
;;;130 /* Printf message with AD value to serial port every 1 second */
;;;131 if (Clock1s) {
0000de 7821 LDRB r1,[r4,#0] ; Clock1s
0000e0 2900 CMP r1,#0
0000e2 d0f0 BEQ |L5.198|
|L5.228|
;;;132 Clock1s = 0;
0000e4 4601 MOV r1,r0
0000e6 7025 STRB r5,[r4,#0] ; Clock1s
;;;133 printf("The current AD value = 0x%04X \r\n", AD_value);
0000e8 a014 ADR r0,|L5.316|
0000ea f7fffffe BL __1printf
0000ee e7ea B |L5.198|
;;;134 }
;;;135
;;;136 }
;;;137 }
;;;138
ENDP
|L5.240|
0000f0 0d0a2055 DCB "\r\n\40\125"
0000f4 53415254 DCB "SART"
0000f8 31207072 DCB "1 pr"
0000fc 696e7420 DCB "int "
000100 41445f76 DCB "AD_v"
000104 616c7565 DCB "alue"
000108 202d2d2d DCB " ---"
00010c 2d2d2d2d DCB "----"
000110 2d2d2d2d DCB "----"
000114 2d2d2d2d DCB "----"
000118 2d2d2d2d DCB "----"
00011c 2d2d2d2d DCB "----"
000120 2d2d2d20 DCB "--- "
000124 0d0a0000 DCB "\r\n\0\0"
|L5.296|
000128 40020008 DCD 0x40020008
|L5.300|
00012c 4001244c DCD 0x4001244c
|L5.304|
000130 00000014 DCD ||.bss||+0x14
|L5.308|
000134 00000002 DCD ||.data||+0x2
|L5.312|
000138 000dbba0 DCD 0x000dbba0
|L5.316|
00013c 54686520 DCB "The "
000140 63757272 DCB "curr"
000144 656e7420 DCB "ent "
000148 41442076 DCB "AD v"
00014c 616c7565 DCB "alue"
000150 203d2030 DCB " = 0"
000154 78253034 DCB "x%04"
000158 58200d0a DCB "X \r\n"
00015c 00000000 DCB "\0\0\0\0"
AREA ||i.fputc||, CODE, READONLY, ALIGN=2
fputc PROC
;;;329 int fputc(int ch, FILE *f)
;;;330 {
000000 b510 PUSH {r4,lr}
000002 4604 MOV r4,r0
;;;331 #ifdef DBG_ITM
;;;332 /* 将Printf内容发往ITM激励寄存器端口 */
;;;333 if (DEMCR & TRCENA) {
;;;334 while (ITM_Port32(0) == 0);
;;;335 ITM_Port8(0) = ch;
;;;336 }
;;;337 #else
;;;338 /* 将Printf内容发往串口 */
;;;339 USART_SendData(USART1, (unsigned char) ch);
000004 b2c1 UXTB r1,r0
000006 4805 LDR r0,|L6.28|
000008 f7fffffe BL USART_SendData
00000c 4804 LDR r0,|L6.32|
;;;340 while (!(USART1->SR & USART_FLAG_TXE));
00000e bf00 NOP
|L6.16|
000010 f8b01800 LDRH r1,[r0,#0x800]
000014 0609 LSLS r1,r1,#24
000016 d5fb BPL |L6.16|
;;;341 #endif
;;;342 return (ch);
000018 4620 MOV r0,r4
;;;343 }
00001a bd10 POP {r4,pc}
;;;344
ENDP
|L6.28|
00001c 40013800 DCD 0x40013800
|L6.32|
000020 40013000 DCD 0x40013000
AREA ||.data||, DATA, ALIGN=2
Clock1s
000000 00 DCB 0x00
HSEStartUpStatus
000001 00 DCB 0x00
ADC_ConvertedValue
000002 0000 DCB 0x00,0x00
AD_value
000004 00000000 DCD 0x00000000
ticks
000008 00000000 DCD 0x00000000
AREA ||.bss||, DATA, NOINIT, ALIGN=2
ADC_InitStructure
% 20
DMA_InitStructure
% 44
__ARM_use_no_argv EQU 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?