91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 265KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2021-06-06
  • 語言: 其他
  • 標簽: STM32F030??ADC??

資源簡介

STM32F030使用ADC功能的例子,用定時器控制采樣頻率,用了DMA傳輸。程序注釋也比較詳細。其中還對比了STM32F103和STM32F030使用ADC時代碼的細微區別。

資源截圖

代碼片段和文件信息


#include?“adc.h“

/*?Private?typedef?-----------------------------------------------------------*/
/*?Private?define?------------------------------------------------------------*/
#define?ADC1_DR_Address????????????????0x40012440
__IO?uint16_t?RegularConvData_Tab[4];
void?ADC1_DMA_Init(void)
{
??ADC_InitTypeDef?????ADC_InitStruct;
??DMA_InitTypeDef?????DMA_InitStruct;
GPIO_InitTypeDef????GPIO_InitStruct;
NVIC_InitTypeDef?NVIC_InitStructure;
TIM_TimebaseInitTypeDef??TIM_TimebaseStructure;
??/*?ADC1?DeInit?*/??
??ADC_DeInit(ADC1);

/*?Enable??GPIOA?clock?*/
??RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA?ENABLE);
??/*?ADC1?Periph?clock?enable?*/
??RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1?ENABLE);
??/*?DMA1?clock?enable?*/
??RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1??ENABLE);

??/*?Configure?PA.01??as?analog?input?*/
??GPIO_InitStruct.GPIO_Pin?=?GPIO_Pin_1;
??GPIO_InitStruct.GPIO_Mode?=?GPIO_Mode_AN;
GPIO_InitStruct.GPIO_PuPd?=?GPIO_PuPd_NOPULL?;
??GPIO_Init(GPIOA?&GPIO_InitStruct); //?PA1輸入時不用設置速率


????GPIO_InitStruct.GPIO_Pin?=?GPIO_Pin_4;
????GPIO_InitStruct.GPIO_Speed?=?GPIO_Speed_10MHz;
????GPIO_InitStruct.GPIO_Mode?=?GPIO_Mode_OUT;
????GPIO_InitStruct.GPIO_OType?=?GPIO_OType_PP;
????GPIO_Init(GPIOA?&GPIO_InitStruct);

?
??/*?DMA1?Channel1?Config?*/
??DMA_DeInit(DMA1_Channel1);//復位DMA1_channel1
??DMA_InitStruct.DMA_PeripheralbaseAddr?=?(uint32_t)ADC1_DR_Address;
??DMA_InitStruct.DMA_MemorybaseAddr?=?(uint32_t)&RegularConvData_Tab;
??DMA_InitStruct.DMA_DIR?=?DMA_DIR_PeripheralSRC;//源地址為外設
??DMA_InitStruct.DMA_BufferSize?=1;
??DMA_InitStruct.DMA_PeripheralInc?=?DMA_PeripheralInc_Disable;//外設地址寄存器不變
??DMA_InitStruct.DMA_MemoryInc?=?DMA_MemoryInc_Enable;//內存地址寄存器遞增
??DMA_InitStruct.DMA_PeripheralDataSize?=?DMA_PeripheralDataSize_HalfWord;//16位
??DMA_InitStruct.DMA_MemoryDataSize?=?DMA_MemoryDataSize_HalfWord;//16位
??DMA_InitStruct.DMA_Mode?=?DMA_Mode_Circular;//不停傳送
??DMA_InitStruct.DMA_Priority?=?DMA_Priority_High;
??DMA_InitStruct.DMA_M2M?=?DMA_M2M_Disable;//
??DMA_Init(DMA1_Channel1?&DMA_InitStruct);
??

//?DMA?Transfer?Complete?Interrupt?enable?
NVIC_InitStructure.NVIC_IRQChannel?=?DMA1_Channel1_IRQn;???//通道
NVIC_InitStructure.NVIC_IRQChannelPriority?=?0;?//占先級
NVIC_InitStructure.NVIC_IRQChannelCmd?=?ENABLE;???????????//啟動
NVIC_Init(&NVIC_InitStructure);???????????????????????????//初始化
?
DMA_ITConfig(DMA1_Channel1DMA_IT_TCENABLE);
DMA_ClearITPendingBit(DMA_IT_TC);??
??/*?DMA1?Channel1?enable?*/
??DMA_Cmd(DMA1_Channel1?ENABLE);


///////////////////////////////////////////////////////////////////////
TIM_DeInit(TIM1);
//定時器1控制采樣率
TIM_TimebaseStructure.TIM_Prescaler=?8-1;
TIM_TimebaseStructure.TIM_CounterMode=?TIM_CounterMode_Up;
TIM_TimebaseStructure.TIM_Period=?833;
TIM_TimebaseStructure.TIM_ClockDivision=?0;
TIM_TimebaseStructure.TIM_RepetitionCounter?=?0;
TIM_TimebaseInit(?TIM1?&TIM_TimebaseStructure);
TIM_SelectOutputTrigger(?TI

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????5692??2017-08-10?17:39??drive\ADC\adc.c

?????文件????????113??2012-08-02?13:16??drive\ADC\adc.h

?????文件???????4458??2017-08-10?05:56??drive\USART\uart.c

?????文件????????292??2012-08-17?15:04??drive\USART\uart.h

?????文件??????19520??2012-04-25?11:09??lib\inc\stm32f0xx_adc.h

?????文件??????12353??2012-04-25?11:09??lib\inc\stm32f0xx_cec.h

?????文件??????10385??2012-04-25?11:09??lib\inc\stm32f0xx_comp.h

?????文件???????3680??2012-04-25?11:09??lib\inc\stm32f0xx_crc.h

?????文件???????7138??2012-04-25?11:09??lib\inc\stm32f0xx_dac.h

?????文件???????3892??2012-04-25?11:09??lib\inc\stm32f0xx_dbgmcu.h

?????文件??????14207??2012-04-25?11:09??lib\inc\stm32f0xx_dma.h

?????文件???????8617??2012-04-25?11:09??lib\inc\stm32f0xx_exti.h

?????文件??????10957??2012-04-25?11:09??lib\inc\stm32f0xx_flash.h

?????文件??????13174??2012-04-25?11:09??lib\inc\stm32f0xx_gpio.h

?????文件??????18136??2012-04-25?11:09??lib\inc\stm32f0xx_i2c.h

?????文件???????4531??2012-04-25?11:09??lib\inc\stm32f0xx_iwdg.h

?????文件???????4413??2012-04-25?11:09??lib\inc\stm32f0xx_misc.h

?????文件???????5909??2012-04-25?11:09??lib\inc\stm32f0xx_pwr.h

?????文件??????20615??2012-04-25?11:09??lib\inc\stm32f0xx_rcc.h

?????文件??????35039??2012-04-25?11:09??lib\inc\stm32f0xx_rtc.h

?????文件??????22351??2012-04-25?11:09??lib\inc\stm32f0xx_spi.h

?????文件???????9166??2012-04-25?11:09??lib\inc\stm32f0xx_syscfg.h

?????文件??????51670??2012-04-25?11:09??lib\inc\stm32f0xx_tim.h

?????文件??????25538??2012-04-25?11:09??lib\inc\stm32f0xx_usart.h

?????文件???????3537??2012-04-25?11:09??lib\inc\stm32f0xx_wwdg.h

?????文件??????45762??2012-08-01?14:51??lib\src\stm32f0xx_adc.c

?????文件??????24186??2012-04-25?11:09??lib\src\stm32f0xx_cec.c

?????文件??????15551??2012-04-25?11:09??lib\src\stm32f0xx_comp.c

?????文件???????8694??2012-04-25?11:09??lib\src\stm32f0xx_crc.c

?????文件??????18920??2012-04-25?11:09??lib\src\stm32f0xx_dac.c

............此處省略43個文件信息

評論

共有 條評論