ADC

所属分类:Windows编程
开发工具:C/C++
文件大小:546KB
下载次数:3
上传日期:2018-09-27 14:14:44
上 传 者lhy_520
说明:  STM32Cube的ADC例程,可以用system workbench for stm32打开
(The ADC routine of STM32Cube can be opened with system workbench for STM32.)

文件列表:
ADC_AnalogWatchdog (0, 2018-09-25)
ADC_AnalogWatchdog\EWARM (0, 2018-09-25)
ADC_AnalogWatchdog\EWARM\Project.ewd (45356, 2018-01-03)
ADC_AnalogWatchdog\EWARM\Project.ewp (30018, 2018-01-03)
ADC_AnalogWatchdog\EWARM\Project.eww (161, 2018-01-03)
ADC_AnalogWatchdog\EWARM\startup_stm32h743xx.s (40194, 2018-01-03)
ADC_AnalogWatchdog\EWARM\stm32h743xx_flash.icf (1598, 2018-01-03)
ADC_AnalogWatchdog\Inc (0, 2018-09-25)
ADC_AnalogWatchdog\Inc\main.h (6741, 2018-01-03)
ADC_AnalogWatchdog\Inc\stm32h7xx_hal_conf.h (14980, 2018-01-03)
ADC_AnalogWatchdog\Inc\stm32h7xx_it.h (3376, 2018-01-03)
ADC_AnalogWatchdog\MDK-ARM (0, 2018-09-25)
ADC_AnalogWatchdog\MDK-ARM\Project.uvoptx (16251, 2018-01-03)
ADC_AnalogWatchdog\MDK-ARM\Project.uvprojx (19719, 2018-01-03)
ADC_AnalogWatchdog\MDK-ARM\startup_stm32h743xx.s (44971, 2018-01-03)
ADC_AnalogWatchdog\Src (0, 2018-09-25)
ADC_AnalogWatchdog\Src\main.c (27982, 2018-01-03)
ADC_AnalogWatchdog\Src\stm32h7xx_hal_msp.c (10539, 2018-01-03)
ADC_AnalogWatchdog\Src\stm32h7xx_it.c (6498, 2018-01-03)
ADC_AnalogWatchdog\Src\system_stm32h7xx.c (11335, 2018-01-03)
ADC_AnalogWatchdog\SW4STM32 (0, 2018-09-25)
ADC_AnalogWatchdog\SW4STM32\startup_stm32h743xx.s (36196, 2018-01-03)
ADC_AnalogWatchdog\SW4STM32\STM32H743ZI-Nucleo (0, 2018-09-25)
ADC_AnalogWatchdog\SW4STM32\STM32H743ZI-Nucleo\.cproject (12379, 2018-01-03)
ADC_AnalogWatchdog\SW4STM32\STM32H743ZI-Nucleo\.project (4817, 2018-01-03)
ADC_AnalogWatchdog\SW4STM32\STM32H743ZI-Nucleo\STM32H743ZITx_FLASH.ld (4829, 2018-01-03)
ADC_DAC_Interconnect (0, 2018-09-25)
ADC_DAC_Interconnect\EWARM (0, 2018-09-25)
ADC_DAC_Interconnect\EWARM\Project.ewd (45356, 2018-01-03)
ADC_DAC_Interconnect\EWARM\Project.ewp (30145, 2018-01-03)
ADC_DAC_Interconnect\EWARM\Project.eww (151, 2018-01-03)
ADC_DAC_Interconnect\EWARM\startup_stm32h743xx.s (40194, 2018-01-03)
ADC_DAC_Interconnect\EWARM\stm32h743xx_flash.icf (1598, 2018-01-03)
ADC_DAC_Interconnect\Inc (0, 2018-09-25)
ADC_DAC_Interconnect\Inc\main.h (2803, 2018-01-03)
ADC_DAC_Interconnect\Inc\stm32h7xx_hal_conf.h (14980, 2018-01-03)
ADC_DAC_Interconnect\Inc\stm32h7xx_it.h (3146, 2018-01-03)
ADC_DAC_Interconnect\MDK-ARM (0, 2018-09-25)
ADC_DAC_Interconnect\MDK-ARM\Project.uvoptx (16838, 2018-01-03)
... ...

/** @page ADC_OverSampler ADC OverSampler example @verbatim ******************** (C) COPYRIGHT 2017 STMicroelectronics ******************* * @file ADC/ADC_OverSampler/readme.txt * @author MCD Application Team * @version V1.2.0 * @date 29-December-2017 * @brief Description of the ADC Oversampler example. ****************************************************************************** * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** @endverbatim @par Example Description This example describes how to configure and use the ADC to convert an external analog input combined with oversampling feature to increase resolution through the HAL API. At the beginning of the main program the HAL_Init() function is called to reset all the peripherals, initialize the Flash interface and the systick. The SystemClock_Config() function is used to configure the system clock for STM32H743xx Devices : The CPU at 400MHz The HCLK for D1 Domain AXI and AHB3 peripherals , D2 Domain AHB1/AHB2 peripherals and D3 Domain AHB4 peripherals at 200MHz. The APB clock dividers for D1 Domain APB3 peripherals, D2 Domain APB1 and APB2 peripherals and D3 Domain APB4 peripherals to run at 100MHz The ADC is configured to convert continuously ADC_CHANNEL_3 connected to PA.06 (connector CN12 pin 13) while the oversampler is enabled. Oversampling ratio is set to 1024 so the maximum output result is 0xFFFF * 1024 = 0x3FFFC00 (26 bits). Result is 6-bit right shift. uwConvertedValue variable contains the 20-bit conversion result and uwInputVoltage yields the input voltage in mV. Use an external power supply, adjust supply voltage and connect it to pin PA.06 (connector CN12 pin 13). This allows to modify ADC_CHANNEL_3 voltage. The converted value is monitored through debugger: uwConvertedValue and uwInputVoltage variables. STM32 board LED can be used to monitor the conversion: - LED3 is ON when there is an error in initialization. @note Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds) based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower) than the peripheral interrupt. Otherwise the caller ISR process will be blocked. To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function. @note The example need to ensure that the SysTick time base is always set to 1 millisecond to have correct HAL operation. @Note If the application is using the DTCM/ITCM memories (@0x20000000/ 0x0000000: not cacheable and only accessible by the Cortex M7 and the MDMA), no need for cache maintenance when the Cortex M7 and the MDMA access these RAMs. If the application needs to use DMA(or other masters) based access or requires more RAM, then the user has to: - Use a non TCM SRAM. (example : D1 AXI-SRAM @ 0x24000000) - Add a cache maintenance mechanism to ensure the cache coherence between CPU and other masters(DMAs,DMA2D,LTDC,MDMA). - The addresses and the size of cacheable buffers (shared between CPU and other masters) must be properlydefined to be aligned to L1-CACHE line size (32 bytes). @Note It is recommended to enable the cache and maintain its coherence, but depending on the use case It is also possible to configure the MPU as "Write through", to guarantee the write access coherence. In that case, the MPU must be configured as Cacheable/Bufferable/Not Shareable. Even though the user must manage the cache coherence for read accesses. Please refer to the AN4838 “Managing memory protection unit (MPU) in STM32 MCUs” Please refer to the AN4839 “Level 1 cache on STM32F7 Series” @par Directory contents - ADC/ADC_OverSampler/Inc/stm32h7xx_hal_conf.h HAL configuration file - ADC/ADC_OverSampler/Inc/stm32h7xx_it.h Interrupt handlers header file - ADC/ADC_OverSampler/Inc/main.h Header for main.c module - ADC/ADC_OverSampler/Src/stm32h7xx_it.c Interrupt handlers - ADC/ADC_OverSampler/Src/main.c Main program - ADC/ADC_OverSampler/Src/stm32h7xx_hal_msp.c HAL MSP file - ADC/ADC_OverSampler/Src/system_stm32h7xx.c STM32H7xx system source file @par Hardware and Software environment - This example runs on STM32H743ZI-Nucleo devices. - This example has been tested with STM32H743ZI-Nucleo board and can be easily tailored to any other supported device and development board. @par How to use it ? In order to make the program work, you must do the following : - Open your preferred toolchain - Rebuild all files and load your image into target memory - Run the example *

© COPYRIGHT STMicroelectronics

*/

近期下载者

相关文件


收藏者