; generated by Component: ARM Compiler 5.06 update 7 (build 960) Tool: ArmCC [4d365d]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o..\output\adc_singleconversion.o --asm_dir=..\List\ --list_dir=..\List\ --depend=..\output\adc_singleconversion.d --cpu=Cortex-M0+ --apcs=interwork --diag_suppress=9931 -I..\FWLib\SC32F1XXX_Lib\inc -I..\User\HeadFiles -I..\User -I..\Drivers -I..\Apps -I..\CMSIS -IF:\Users\SOC\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\Device\ARM\ARMCM0plus\Include -D__UVISION_VERSION=536 -DARMCM0P -DSC32f10xx --omf_browse=..\output\adc_singleconversion.crf ..\Apps\ADC_SingleConversion.c]
                          THUMB

                          AREA ||i.ADC_AverageValue||, CODE, READONLY, ALIGN=2

                  ADC_AverageValue PROC
;;;63     //ADC采样10次求平均值（去除最大最小值）
;;;64     uint16_t ADC_AverageValue(void)
000000  b5f8              PUSH     {r3-r7,lr}
;;;65     {
;;;66         uint16_t i;
;;;67         uint16_t ADC_ValueMax = 0, ADC_ValueMin = 0X01 << 14, ADC_ValueMean = 0, ADC_ValueTad = 0;
000002  2600              MOVS     r6,#0
000004  2501              MOVS     r5,#1
000006  03ad              LSLS     r5,r5,#14
;;;68         uint32_t ADC_ValueSum = 0;
000008  4637              MOV      r7,r6
;;;69     	for(i=0;i<10;i++)
00000a  4634              MOV      r4,r6
                  |L1.12|
;;;70     	{
;;;71             ADC_SoftwareStartConv(ADC);// 开启转换
00000c  480d              LDR      r0,|L1.68|
00000e  f7fffffe          BL       ADC_SoftwareStartConv
;;;72     		
;;;73             while(ADC_Flag == RESET);//等待ADC单次转换完成
000012  480d              LDR      r0,|L1.72|
                  |L1.20|
000014  7801              LDRB     r1,[r0,#0]  ; ADC_Flag
000016  2900              CMP      r1,#0
000018  d0fc              BEQ      |L1.20|
;;;74             ADC_Flag = RESET;
00001a  2100              MOVS     r1,#0
00001c  7001              STRB     r1,[r0,#0]
;;;75     		
;;;76     		ADC_ValueTad = ADC_GetConversionValue(ADC);  //获取一次ADC转换值
00001e  4809              LDR      r0,|L1.68|
000020  f7fffffe          BL       ADC_GetConversionValue
;;;77     		if(ADC_ValueTad>ADC_ValueMax)
000024  42b0              CMP      r0,r6
000026  d900              BLS      |L1.42|
;;;78     		{
;;;79     		   ADC_ValueMax = ADC_ValueTad;
000028  4606              MOV      r6,r0
                  |L1.42|
;;;80     		}
;;;81     		if(ADC_ValueTad<ADC_ValueMin)
00002a  42a8              CMP      r0,r5
00002c  d200              BCS      |L1.48|
;;;82     		{
;;;83     		   ADC_ValueMin = ADC_ValueTad;
00002e  4605              MOV      r5,r0
                  |L1.48|
;;;84     		}
;;;85     		ADC_ValueSum += ADC_ValueTad;
000030  1c64              ADDS     r4,r4,#1
000032  183f              ADDS     r7,r7,r0
000034  b2a4              UXTH     r4,r4                 ;69
000036  2c0a              CMP      r4,#0xa               ;69
000038  d3e8              BCC      |L1.12|
;;;86     	}
;;;87       ADC_ValueMean = (uint16_t)((ADC_ValueSum - ADC_ValueMax - ADC_ValueMin) / 8);
00003a  1bb8              SUBS     r0,r7,r6
00003c  1b40              SUBS     r0,r0,r5
00003e  0340              LSLS     r0,r0,#13
000040  0c00              LSRS     r0,r0,#16
;;;88       return ADC_ValueMean;
;;;89     }
000042  bdf8              POP      {r3-r7,pc}
;;;90     void ADC_SingleConversion_ADCHandler(void)
                          ENDP

                  |L1.68|
                          DCD      0x40022110
                  |L1.72|
                          DCD      ||.data||

                          AREA ||i.ADC_SingleConversion_ADCHandler||, CODE, READONLY, ALIGN=2

                  ADC_SingleConversion_ADCHandler PROC
;;;89     }
;;;90     void ADC_SingleConversion_ADCHandler(void)
000000  b510              PUSH     {r4,lr}
;;;91     {
;;;92       if(ADC_GetFlagStatus(ADC,ADC_Flag_ADCIF)) //判断ADC标志位
000002  4c07              LDR      r4,|L2.32|
000004  2101              MOVS     r1,#1
000006  4620              MOV      r0,r4
000008  f7fffffe          BL       ADC_GetFlagStatus
00000c  2800              CMP      r0,#0
00000e  d006              BEQ      |L2.30|
;;;93       {
;;;94         ADC_ClearFlag(ADC,ADC_Flag_ADCIF);  //清除ADC标志位
000010  2101              MOVS     r1,#1
000012  4620              MOV      r0,r4
000014  f7fffffe          BL       ADC_ClearFlag
;;;95         ADC_Flag = SET;  //自定义标志置起
000018  4902              LDR      r1,|L2.36|
00001a  2001              MOVS     r0,#1
00001c  7008              STRB     r0,[r1,#0]
                  |L2.30|
;;;96       }
;;;97     }
00001e  bd10              POP      {r4,pc}
                          ENDP

                  |L2.32|
                          DCD      0x40022110
                  |L2.36|
                          DCD      ||.data||

                          AREA ||i.ADC_SingleConversion_Function||, CODE, READONLY, ALIGN=2

                          REQUIRE _printf_percent
                          REQUIRE _printf_x
                          REQUIRE _printf_longlong_hex
                  ADC_SingleConversion_Function PROC
;;;13     
;;;14     void ADC_SingleConversion_Function(void)
000000  b086              SUB      sp,sp,#0x18
;;;15     {
;;;16        static volatile uint16_t ADC_Value_VDD4 = 0, ADC_Value0 = 0;
;;;17     	 GPIO_InitTypeDef GPIO_InitStruct; //定义GPIO初始化结构体变量
;;;18     #if defined(SC32f10xx) 
;;;19       /* PC6设置为推挽输出 */
;;;20       GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6;
000002  2040              MOVS     r0,#0x40
000004  4669              MOV      r1,sp
000006  8208              STRH     r0,[r1,#0x10]
;;;21       GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_PU;
000008  2401              MOVS     r4,#1
00000a  824c              STRH     r4,[r1,#0x12]
;;;22       GPIO_Init(GPIOC, &GPIO_InitStruct);
00000c  a904              ADD      r1,sp,#0x10
00000e  481e              LDR      r0,|L3.136|
000010  f7fffffe          BL       GPIO_Init
;;;23     #elif defined(SC32f12xx) 
;;;24       /* PC6设置为推挽输出 */
;;;25       GPIO_InitStruct.GPIO_Pin = GPIO_Pin_2;
;;;26       GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_PU;
;;;27       GPIO_Init(GPIOB, &GPIO_InitStruct);	
;;;28     
;;;29     #endif
;;;30       ADC_InitTypeDef ADC_InitStruct; //定义ADC初始化结构体变量
;;;31     
;;;32       RCC_APB2Cmd(ENABLE);  //ADC外设挂载在APB2时钟上
000014  2001              MOVS     r0,#1
000016  f7fffffe          BL       RCC_APB2Cmd
;;;33     
;;;34       ADC_StructInit(&ADC_InitStruct);
00001a  4668              MOV      r0,sp
00001c  f7fffffe          BL       ADC_StructInit
;;;35       
;;;36       ADC_InitStruct.ADC_ConvMode = ADC_ConvMode_Single;  //ADC单次转换模式
000020  2000              MOVS     r0,#0
000022  4669              MOV      r1,sp
000024  8188              STRH     r0,[r1,#0xc]
;;;37       ADC_InitStruct.ADC_Prescaler = ADC_Prescaler_3CLOCK;  //转换时间为3个周期
000026  04a1              LSLS     r1,r4,#18
;;;38     #if defined(SC32f10xx) || defined(SC32f12xx) 
;;;39       ADC_InitStruct.ADC_VREF = ADC_VREF_VDD; //参考电压为VDD
;;;40     #endif
;;;41       ADC_InitStruct.ADC_EAIN = ADC_EAIN_0; //把ADC0设为ADC输入引脚
;;;42       
;;;43       ADC_Init(ADC, &ADC_InitStruct); //根据结构体标志位配置ADC
000028  4d18              LDR      r5,|L3.140|
00002a  9100              STR      r1,[sp,#0]
00002c  9002              STR      r0,[sp,#8]
00002e  9401              STR      r4,[sp,#4]
000030  4669              MOV      r1,sp
000032  4628              MOV      r0,r5
000034  f7fffffe          BL       ADC_Init
;;;44       ADC_SetChannel(ADC,ADC_Channel_0);
000038  2100              MOVS     r1,#0
00003a  4628              MOV      r0,r5
00003c  f7fffffe          BL       ADC_SetChannel
;;;45     #if defined(SC32f10xx) || defined(SC32f12xx) 
;;;46       ADC_ITConfig(ADC, ADC_IT_ADCIF, ENABLE);	//使能ADC中断
000040  2201              MOVS     r2,#1
000042  0211              LSLS     r1,r2,#8
000044  4628              MOV      r0,r5
000046  f7fffffe          BL       ADC_ITConfig
00004a  4a11              LDR      r2,|L3.144|
00004c  0761              LSLS     r1,r4,#29
00004e  6011              STR      r1,[r2,#0]
;;;47     #endif
;;;48       NVIC_EnableIRQ(ADC_IRQn);
;;;49     
;;;50       ADC_Cmd(ADC, ENABLE);	//使能ADC
000050  2101              MOVS     r1,#1
000052  4628              MOV      r0,r5
000054  f7fffffe          BL       ADC_Cmd
;;;51       while(1)
;;;52     	{
;;;53     	  ADC_SetChannel(ADC, ADC_Channel_VDD_D4);//设置ADC采样通道为VDD/4
;;;54     		ADC_Value_VDD4 = ADC_AverageValue();//获取平均采样值
000058  4c0e              LDR      r4,|L3.148|
                  |L3.90|
00005a  211f              MOVS     r1,#0x1f              ;53
00005c  4628              MOV      r0,r5                 ;53
00005e  f7fffffe          BL       ADC_SetChannel
000062  f7fffffe          BL       ADC_AverageValue
000066  8060              STRH     r0,[r4,#2]
;;;55     	  printf("\r\n ADC VDD/4 Conversion Value is 0x%x \r\n", ADC_Value_VDD4);
000068  8861              LDRH     r1,[r4,#2]  ; ADC_Value_VDD4
00006a  a00b              ADR      r0,|L3.152|
00006c  f7fffffe          BL       __2printf
;;;56     		
;;;57     		ADC_SetChannel(ADC, ADC_Channel_0);//设置ADC采样通道为AIN0
000070  2100              MOVS     r1,#0
000072  4628              MOV      r0,r5
000074  f7fffffe          BL       ADC_SetChannel
;;;58     		ADC_Value0 = ADC_AverageValue();//获取平均采样值
000078  f7fffffe          BL       ADC_AverageValue
00007c  80a0              STRH     r0,[r4,#4]
;;;59     	  printf("\r\n ADC AIN0 Conversion Value is 0x%x \r\n", ADC_Value0);
00007e  88a1              LDRH     r1,[r4,#4]  ; ADC_Value0
000080  a010              ADR      r0,|L3.196|
000082  f7fffffe          BL       __2printf
000086  e7e8              B        |L3.90|
;;;60     	}
;;;61     
;;;62     }
;;;63     //ADC采样10次求平均值（去除最大最小值）
                          ENDP

                  |L3.136|
                          DCD      0x40011200
                  |L3.140|
                          DCD      0x40022110
                  |L3.144|
                          DCD      0xe000e100
                  |L3.148|
                          DCD      ||.data||
                  |L3.152|
000098  0d0a2041          DCB      "\r\n ADC VDD/4 Conversion Value is 0x%x \r\n",0
00009c  44432056
0000a0  44442f34
0000a4  20436f6e
0000a8  76657273
0000ac  696f6e20
0000b0  56616c75
0000b4  65206973
0000b8  20307825
0000bc  78200d0a
0000c0  00      
0000c1  00                DCB      0
0000c2  00                DCB      0
0000c3  00                DCB      0
                  |L3.196|
0000c4  0d0a2041          DCB      "\r\n ADC AIN0 Conversion Value is 0x%x \r\n",0
0000c8  44432041
0000cc  494e3020
0000d0  436f6e76
0000d4  65727369
0000d8  6f6e2056
0000dc  616c7565
0000e0  20697320
0000e4  30782578
0000e8  200d0a00

                          AREA ||.data||, DATA, ALIGN=1

                  ADC_Flag
000000  0000              DCB      0x00,0x00
                  ADC_Value_VDD4
000002  0000              DCW      0x0000
                  ADC_Value0
000004  0000              DCW      0x0000

;*** Start embedded assembler ***

#line 1 "..\\Apps\\ADC_SingleConversion.c"
	AREA ||.rev16_text||, CODE
	THUMB
	EXPORT |__asm___22_ADC_SingleConversion_c_39a00e25____REV16|
#line 463 "..\\CMSIS\\cmsis_armcc.h"
|__asm___22_ADC_SingleConversion_c_39a00e25____REV16| PROC
#line 464

 rev16 r0, r0
 bx lr
	ENDP
	AREA ||.revsh_text||, CODE
	THUMB
	EXPORT |__asm___22_ADC_SingleConversion_c_39a00e25____REVSH|
#line 478
|__asm___22_ADC_SingleConversion_c_39a00e25____REVSH| PROC
#line 479

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
