⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm32f10x_adc.txt

📁 STM32手持式示波器源代码
💻 TXT
📖 第 1 页 / 共 4 页
字号:
;;;594      assert_param(IS_ADC_CHANNEL(ADC_Channel));
;;;595      assert_param(IS_ADC_REGULAR_RANK(Rank));
;;;596      assert_param(IS_ADC_SAMPLE_TIME(ADC_SampleTime));
;;;597      /* if ADC_Channel_10 ... ADC_Channel_17 is selected */
;;;598      if (ADC_Channel > ADC_Channel_9)
000006  2909              CMP      r1,#9
000008  dd11              BLE      |L29.46|
;;;599      {
;;;600        /* Get the old register value */
;;;601        tmpreg1 = ADCx->SMPR1;
00000a  68c4              LDR      r4,[r0,#0xc]
;;;602        /* Calculate the mask to clear */
;;;603        tmpreg2 = SMPR1_SMP_Set << (3 * (ADC_Channel - 10));
00000c  f1a1060a          SUB      r6,r1,#0xa
000010  eb060746          ADD      r7,r6,r6,LSL #1
000014  2607              MOVS     r6,#7
000016  fa06f507          LSL      r5,r6,r7
;;;604        /* Clear the old channel sample time */
;;;605        tmpreg1 &= ~tmpreg2;
00001a  43ac              BICS     r4,r4,r5
;;;606        /* Calculate the mask to set */
;;;607        tmpreg2 = (uint32_t)ADC_SampleTime << (3 * (ADC_Channel - 10));
00001c  f1a1060a          SUB      r6,r1,#0xa
000020  eb060646          ADD      r6,r6,r6,LSL #1
000024  fa03f506          LSL      r5,r3,r6
;;;608        /* Set the new channel sample time */
;;;609        tmpreg1 |= tmpreg2;
000028  432c              ORRS     r4,r4,r5
;;;610        /* Store the new register value */
;;;611        ADCx->SMPR1 = tmpreg1;
00002a  60c4              STR      r4,[r0,#0xc]
00002c  e00c              B        |L29.72|
                  |L29.46|
;;;612      }
;;;613      else /* ADC_Channel include in ADC_Channel_[0..9] */
;;;614      {
;;;615        /* Get the old register value */
;;;616        tmpreg1 = ADCx->SMPR2;
00002e  6904              LDR      r4,[r0,#0x10]
;;;617        /* Calculate the mask to clear */
;;;618        tmpreg2 = SMPR2_SMP_Set << (3 * ADC_Channel);
000030  eb010741          ADD      r7,r1,r1,LSL #1
000034  2607              MOVS     r6,#7
000036  fa06f507          LSL      r5,r6,r7
;;;619        /* Clear the old channel sample time */
;;;620        tmpreg1 &= ~tmpreg2;
00003a  43ac              BICS     r4,r4,r5
;;;621        /* Calculate the mask to set */
;;;622        tmpreg2 = (uint32_t)ADC_SampleTime << (3 * ADC_Channel);
00003c  eb010641          ADD      r6,r1,r1,LSL #1
000040  fa03f506          LSL      r5,r3,r6
;;;623        /* Set the new channel sample time */
;;;624        tmpreg1 |= tmpreg2;
000044  432c              ORRS     r4,r4,r5
;;;625        /* Store the new register value */
;;;626        ADCx->SMPR2 = tmpreg1;
000046  6104              STR      r4,[r0,#0x10]
                  |L29.72|
;;;627      }
;;;628      /* For Rank 1 to 6 */
;;;629      if (Rank < 7)
000048  2a07              CMP      r2,#7
00004a  da0f              BGE      |L29.108|
;;;630      {
;;;631        /* Get the old register value */
;;;632        tmpreg1 = ADCx->SQR3;
00004c  6b44              LDR      r4,[r0,#0x34]
;;;633        /* Calculate the mask to clear */
;;;634        tmpreg2 = SQR3_SQ_Set << (5 * (Rank - 1));
00004e  1e56              SUBS     r6,r2,#1
000050  eb060786          ADD      r7,r6,r6,LSL #2
000054  261f              MOVS     r6,#0x1f
000056  fa06f507          LSL      r5,r6,r7
;;;635        /* Clear the old SQx bits for the selected rank */
;;;636        tmpreg1 &= ~tmpreg2;
00005a  43ac              BICS     r4,r4,r5
;;;637        /* Calculate the mask to set */
;;;638        tmpreg2 = (uint32_t)ADC_Channel << (5 * (Rank - 1));
00005c  1e56              SUBS     r6,r2,#1
00005e  eb060686          ADD      r6,r6,r6,LSL #2
000062  fa01f506          LSL      r5,r1,r6
;;;639        /* Set the SQx bits for the selected rank */
;;;640        tmpreg1 |= tmpreg2;
000066  432c              ORRS     r4,r4,r5
;;;641        /* Store the new register value */
;;;642        ADCx->SQR3 = tmpreg1;
000068  6344              STR      r4,[r0,#0x34]
00006a  e022              B        |L29.178|
                  |L29.108|
;;;643      }
;;;644      /* For Rank 7 to 12 */
;;;645      else if (Rank < 13)
00006c  2a0d              CMP      r2,#0xd
00006e  da0f              BGE      |L29.144|
;;;646      {
;;;647        /* Get the old register value */
;;;648        tmpreg1 = ADCx->SQR2;
000070  6b04              LDR      r4,[r0,#0x30]
;;;649        /* Calculate the mask to clear */
;;;650        tmpreg2 = SQR2_SQ_Set << (5 * (Rank - 7));
000072  1fd6              SUBS     r6,r2,#7
000074  eb060786          ADD      r7,r6,r6,LSL #2
000078  261f              MOVS     r6,#0x1f
00007a  fa06f507          LSL      r5,r6,r7
;;;651        /* Clear the old SQx bits for the selected rank */
;;;652        tmpreg1 &= ~tmpreg2;
00007e  43ac              BICS     r4,r4,r5
;;;653        /* Calculate the mask to set */
;;;654        tmpreg2 = (uint32_t)ADC_Channel << (5 * (Rank - 7));
000080  1fd6              SUBS     r6,r2,#7
000082  eb060686          ADD      r6,r6,r6,LSL #2
000086  fa01f506          LSL      r5,r1,r6
;;;655        /* Set the SQx bits for the selected rank */
;;;656        tmpreg1 |= tmpreg2;
00008a  432c              ORRS     r4,r4,r5
;;;657        /* Store the new register value */
;;;658        ADCx->SQR2 = tmpreg1;
00008c  6304              STR      r4,[r0,#0x30]
00008e  e010              B        |L29.178|
                  |L29.144|
;;;659      }
;;;660      /* For Rank 13 to 16 */
;;;661      else
;;;662      {
;;;663        /* Get the old register value */
;;;664        tmpreg1 = ADCx->SQR1;
000090  6ac4              LDR      r4,[r0,#0x2c]
;;;665        /* Calculate the mask to clear */
;;;666        tmpreg2 = SQR1_SQ_Set << (5 * (Rank - 13));
000092  f1a2060d          SUB      r6,r2,#0xd
000096  eb060786          ADD      r7,r6,r6,LSL #2
00009a  261f              MOVS     r6,#0x1f
00009c  fa06f507          LSL      r5,r6,r7
;;;667        /* Clear the old SQx bits for the selected rank */
;;;668        tmpreg1 &= ~tmpreg2;
0000a0  43ac              BICS     r4,r4,r5
;;;669        /* Calculate the mask to set */
;;;670        tmpreg2 = (uint32_t)ADC_Channel << (5 * (Rank - 13));
0000a2  f1a2060d          SUB      r6,r2,#0xd
0000a6  eb060686          ADD      r6,r6,r6,LSL #2
0000aa  fa01f506          LSL      r5,r1,r6
;;;671        /* Set the SQx bits for the selected rank */
;;;672        tmpreg1 |= tmpreg2;
0000ae  432c              ORRS     r4,r4,r5
;;;673        /* Store the new register value */
;;;674        ADCx->SQR1 = tmpreg1;
0000b0  62c4              STR      r4,[r0,#0x2c]
                  |L29.178|
;;;675      }
;;;676    }
0000b2  bdf0              POP      {r4-r7,pc}
;;;677    
                          ENDP


                          AREA ||i.ADC_ResetCalibration||, CODE, READONLY, ALIGN=1

                  ADC_ResetCalibration PROC
;;;377      */
;;;378    void ADC_ResetCalibration(ADC_TypeDef* ADCx)
000000  6881              LDR      r1,[r0,#8]
;;;379    {
;;;380      /* Check the parameters */
;;;381      assert_param(IS_ADC_ALL_PERIPH(ADCx));
;;;382      /* Resets the selected ADC calibartion registers */  
;;;383      ADCx->CR2 |= CR2_RSTCAL_Set;
000002  f0410108          ORR      r1,r1,#8
000006  6081              STR      r1,[r0,#8]
;;;384    }
000008  4770              BX       lr
;;;385    
                          ENDP


                          AREA ||i.ADC_SetInjectedOffset||, CODE, READONLY, ALIGN=1

                  ADC_SetInjectedOffset PROC
;;;1023     */
;;;1024   void ADC_SetInjectedOffset(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset)
000000  b510              PUSH     {r4,lr}
;;;1025   {
;;;1026     __IO uint32_t tmp = 0;
000002  2300              MOVS     r3,#0
;;;1027     
;;;1028     /* Check the parameters */
;;;1029     assert_param(IS_ADC_ALL_PERIPH(ADCx));
;;;1030     assert_param(IS_ADC_INJECTED_CHANNEL(ADC_InjectedChannel));
;;;1031     assert_param(IS_ADC_OFFSET(Offset));  
;;;1032     
;;;1033     tmp = (uint32_t)ADCx;
000004  4603              MOV      r3,r0
;;;1034     tmp += ADC_InjectedChannel;
000006  4618              MOV      r0,r3
000008  440b              ADD      r3,r3,r1
;;;1035     
;;;1036     /* Set the selected injected channel data offset */
;;;1037     *(__IO uint32_t *) tmp = (uint32_t)Offset;
00000a  601a              STR      r2,[r3,#0]
;;;1038   }
00000c  bd10              POP      {r4,pc}
;;;1039   
                          ENDP


                          AREA ||i.ADC_SoftwareStartConvCmd||, CODE, READONLY, ALIGN=1

                  ADC_SoftwareStartConvCmd PROC
;;;455      */
;;;456    void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState)
000000  b121              CBZ      r1,|L32.12|
;;;457    {
;;;458      /* Check the parameters */
;;;459      assert_param(IS_ADC_ALL_PERIPH(ADCx));
;;;460      assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;461      if (NewState != DISABLE)
;;;462      {
;;;463        /* Enable the selected ADC conversion on external event and start the selected
;;;464           ADC conversion */
;;;465        ADCx->CR2 |= CR2_EXTTRIG_SWSTART_Set;
000002  6882              LDR      r2,[r0,#8]
000004  f44202a0          ORR      r2,r2,#0x500000
000008  6082              STR      r2,[r0,#8]
00000a  e003              B        |L32.20|
                  |L32.12|
;;;466      }
;;;467      else
;;;468      {
;;;469        /* Disable the selected ADC conversion on external event and stop the selected
;;;470           ADC conversion */
;;;471        ADCx->CR2 &= CR2_EXTTRIG_SWSTART_Reset;
00000c  6882              LDR      r2,[r0,#8]
00000e  f42202a0          BIC      r2,r2,#0x500000
000012  6082              STR      r2,[r0,#8]
                  |L32.20|
;;;472      }
;;;473    }
000014  4770              BX       lr
;;;474    
                          ENDP


                          AREA ||i.ADC_SoftwareStartInjectedConvCmd||, CODE, READONLY, ALIGN=1

                  ADC_SoftwareStartInjectedConvCmd PROC
;;;847      */
;;;848    void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState)
000000  b121              CBZ      r1,|L33.12|
;;;849    {
;;;850      /* Check the parameters */
;;;851      assert_param(IS_ADC_ALL_PERIPH(ADCx));
;;;852      assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;853      if (NewState != DISABLE)
;;;854      {
;;;855        /* Enable the selected ADC conversion for injected group on external event and start the selected
;;;856           ADC injected conversion */
;;;857        ADCx->CR2 |= CR2_JEXTTRIG_JSWSTART_Set;
000002  6882              LDR      r2,[r0,#8]
000004  f4421202          ORR      r2,r2,#0x208000
000008  6082              STR      r2,[r0,#8]
00000a  e003              B        |L33.20|
                  |L33.12|
;;;858      }
;;;859      else
;;;860      {
;;;861        /* Disable the selected ADC conversion on external event for injected group and stop the selected
;;;862           ADC injected conversion */
;;;863        ADCx->CR2 &= CR2_JEXTTRIG_JSWSTART_Reset;
00000c  6882              LDR      r2,[r0,#8]
00000e  f4221202          BIC      r2,r2,#0x208000
000012  6082              STR      r2,[r0,#8]
                  |L33.20|
;;;864      }
;;;865    }
000014  4770              BX       lr
;;;866    
                          ENDP


                          AREA ||i.ADC_StartCalibration||, CODE, READONLY, ALIGN=1

                  ADC_StartCalibration PROC
;;;415      */
;;;416    void ADC_StartCalibration(ADC_TypeDef* ADCx)
000000  6881              LDR      r1,[r0,#8]
;;;417    {
;;;418      /* Check the parameters */
;;;419      assert_param(IS_ADC_ALL_PERIPH(ADCx));
;;;420      /* Enable the selected ADC calibration process */  
;;;421      ADCx->CR2 |= CR2_CAL_Set;
000002  f0410104          ORR      r1,r1,#4
000006  6081              STR      r1,[r0,#8]
;;;422    }
000008  4770              BX       lr
;;;423    
                          ENDP


                          AREA ||i.ADC_StructInit||, CODE, READONLY, ALIGN=1

                  ADC_StructInit PROC
;;;273      */
;;;274    void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct)
000000  2100              MOVS     r1,#0
;;;275    {
;;;276      /* Reset ADC init structure parameters values */
;;;277      /* Initialize the ADC_Mode member */
;;;278      ADC_InitStruct->ADC_Mode = ADC_Mode_Independent;
000002  6001              STR      r1,[r0,#0]
;;;279      /* initialize the ADC_ScanConvMode member */
;;;280      ADC_InitStruct->ADC_ScanConvMode = DISABLE;
000004  7101              STRB     r1,[r0,#4]
;;;281      /* Initialize the ADC_ContinuousConvMode member */
;;;282      ADC_InitStruct->ADC_ContinuousConvMode = DISABLE;
000006  7141              STRB     r1,[r0,#5]
;;;283      /* Initialize the ADC_ExternalTrigConv member */
;;;284      ADC_InitStruct->ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
000008  6081              STR      r1,[r0,#8]
;;;285      /* Initialize the ADC_DataAlign member */
;;;286      ADC_InitStruct->ADC_DataAlign = ADC_DataAlign_Right;
00000a  60c1              STR      r1,[r0,#0xc]
;;;287      /* Initialize the ADC_NbrOfChannel member */
;;;288      ADC_InitStruct->ADC_NbrOfChannel = 1;
00000c  2101              MOVS     r1,#1
00000e  7401              STRB     r1,[r0,#0x10]
;;;289    }
000010  4770              BX       lr
;;;290    
                          ENDP


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

                  ADC_TempSensorVrefintCmd PROC
;;;1165     */
;;;1166   void ADC_TempSensorVrefintCmd(FunctionalState NewState)
000000  b138              CBZ      r0,|L36.18|
;;;1167   {
;;;1168     /* Check the parameters */
;;;1169     assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;1170     if (NewState != DISABLE)
;;;1171     {
;;;1172       /* Enable the temperature sensor and Vrefint channel*/
;;;1173       ADC1->CR2 |= CR2_TSVREFE_Set;
000002  4908              LDR      r1,|L36.36|
000004  6809              LDR      r1,[r1,#0]
000006  f4410100          ORR      r1,r1,#0x800000
00000a  4a07              LDR      r2,|L36.40|
00000c  f8c21408          STR      r1,[r2,#0x408]
000010  e006              B        |L36.32|
                  |L36.18|
;;;1174     }
;;;1175     else
;;;1176     {
;;;1177       /* Disable the temperature sensor and Vrefint channel*/
;;;1178       ADC1->CR2 &= CR2_TSVREFE_Reset;
000012  4904              LDR      r1,|L36.36|
000014  6809              LDR      r1,[r1,#0]
000016  f4210100          BIC      r1,r1,#0x800000
00001a  4a03              LDR      r2,|L36.40|
00001c  f8c21408          STR      r1,[r2,#0x408]
                  |L36.32|
;;;1179     }
;;;1180   }
000020  4770              BX       lr
;;;1181   
                          ENDP

000022  0000              DCW      0x0000
                  |L36.36|
                          DCD      0x40012408
                  |L36.40|
                          DCD      0x40012000

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -