1˵
    1ADCתڲ¶ȴģѹתΪ¶ֵ
2ʹû
      KEIL MDK-ARM V5.30.0.0
    Ӳ      N32G031C8L7-STB V1.0
3ʹ˵
    ϵͳã
        1ʱԴ
                    HSE=8M,PLL=48M,AHB=48M,APB1=48M,APB2=48M,ADC CLK=48M/16,ADC 1M CLK=HSI/8,DMA CLK=48M
        2DMA
                    DMA_CH1ͨѭģʽһֵADCתADCConvertedValue
        3ADC
                    ADCת12λҶ룬תͨ16ڲ¶ȴģѹ
        4˿ã
                    PA9ѡΪUSART1TX
                    PA10ѡΪUSART1RX
        5USART
                    USART1 115200ʡ8λλ1λֹͣλżУλӲءͺͽʹ
        6ܺ
                    TempValue = TempCal(ADCConvertedValue)¶ADCԭʼʽתΪȵĵλĸʽ
    ʹ÷
        1򿪵ģʽADCConvertedValue,TempValueӵwatchڹ۲
        2ڹӵPA9ţ򿪴ڽչ
        3ȫУԿ¶ȱֵڳ½ӽ25ңͬʱڹʾʵʱоƬڵ¶ֵ
4ע
    ϵͳHSEʱʱһHSIҲǴ򿪵ģRCC_ConfigAdc1mClk(RCC_ADC1MCLK_SRC_HSE, RCC_ADC1MCLK_DIV8)ΪHSEHSI
    ϵͳHSIʱʱһHSEǹرյģRCC_ConfigAdc1mClk(RCC_ADC1MCLK_SRC_HSI, RCC_ADC1MCLK_DIV8)ֻΪHSI



1. Function description
    1. ADC samples and converts the analog voltage of the internal temperature sensor and converts it to a temperature value

2. Use environment
    Software development environment: KEIL MDK-ARM V5.30.0.0
    Hardware environment: Developed based on the evaluation board N32G031C8L7-STB V1.0

3. Instructions for use
    System Configuration;
        1. Clock source:
                    HSE=8M, PLL=48M, AHB=48M, APB1=48M, APB2=48M, ADC CLK=48M/16, ADC 1M CLK=HSI/8, DMA CLK=48M
        2. DMA:
                    DMA1_CH1 channel is configuered as circular mode, carries a half-word ADC conversion result to ADCConvertedValue variable
        3. ADC:
                    ADC configuration: continuous conversion, software trigger, 12-bit data right-aligned, conversion channel 16 is the analog voltage data of the internal temperature sensor
        4. Port configuration:
                    PA9 is selected as the TX pin of USART1
                    PA10 is selected as the RX pin of USART1
        5. USART:
                    USART1 configuration: 115200 baud rate, 8 data bits, 1 stop bit, no parity bit, no hardware flow control, send and receive enable
        6. Function function:
                    The TempValue = TempCal(ADCConvertedValue) function converts the temperature ADC raw format data into the format of the unit of degree
    Instructions:
        1. Open the debug mode after compiling, add the variables ADCConvertedValue, TempValue to the watch window for observation
        2. Connect the serial port tool to the PA9 pin and open the serial port receiving tool
        3. Running at full speed, you can see that the value of the temperature variable is close to about 25 degrees at room temperature, and the serial port tool displays the temperature value in the real-time chip

4. Matters needing attention
    When the system uses the HSE clock (HSI is generally enabled), ), RCC_ConfigAdc1mClk (RCC_ADC1MCLK_SRC_HSE, RCC_ADC1MCLK_DIV8) can be configured as HSE or HSI
    When the system uses the HSI clock(HSE is generally disabled), RCC_ConfigAdc1mClk(RCC_ADC1MCLK_SRC_HSI, RCC_ADC1MCLK_DIV8) can only be configured as HSI