資源簡介
智能水產(chǎn)養(yǎng)殖系統(tǒng).rar

代碼片段和文件信息
#include?“stm32f10x.h“
#include?“adc.h“
#include?“demo.h“ ?
void?adc_init(void)
{
GPIO_InitTypeDef?GPIO_InitStructure;
ADC_InitTypeDef??ADC_InitStructure;
/*?Enable??clock?*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC???ENABLE);
/*?Configure?Ports?*/
GPIO_InitStructure.GPIO_Pin?=?GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Speed?=?GPIO_Speed_2MHz;
GPIO_Init(GPIOC?&GPIO_InitStructure);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1|RCC_APB2Periph_AFIO?ENABLE);
/*?ADC1?Configuration?------------------------------------------------------*/
ADC_InitStructure.ADC_Mode?=?ADC_Mode_Independent; //選擇ADC模式,此處為獨立模式
ADC_InitStructure.ADC_ScanConvMode?=DISABLE; //多通道使能,此處為單通道采集
ADC_InitStructure.ADC_ContinuousConvMode?=?DISABLE?; ?//連續(xù)轉換使能。此處單次轉換,轉換了一個數(shù)據(jù)后就停止
ADC_InitStructure.ADC_ExternalTrigConv?=?ADC_ExternalTrigConv_None;?//選擇外部觸發(fā)模式
ADC_InitStructure.ADC_DataAlign?=?ADC_DataAlign_Right;//數(shù)據(jù)對齊模式
ADC_InitStructure.ADC_NbrOfChannel?=?1;?//通道數(shù)量
ADC_Init(ADC1?&ADC_InitStructure);
}
#define?V_REF?3300
void?adc_read(void)
{
??int?i;
???for(i=0;?i<4;?i++)
???{
????????switch?(i)
????????{
????????????case?0:?ADC_RegularChannelConfig(ADC1?ADC_Channel_10?1?ADC_SampleTime_239Cycles5);?break;
????????????case?1:?ADC_RegularChannelConfig(ADC1?ADC_Channel_11?1?ADC_SampleTime_239Cycles5);?break;
????????????case?2:?ADC_RegularChannelConfig(ADC1?ADC_Channel_12?1?ADC_SampleTime_239Cycles5);?break;
????????????case?3:?ADC_RegularChannelConfig(ADC1?ADC_Channel_13?1?ADC_SampleTime_239Cycles5);?break;
????????}
/*?Enable?ADC1?*/
ADC_Cmd(ADC1?ENABLE);
/*?Enable?ADC1?reset?calibaration?register?*/???
ADC_ResetCalibration(ADC1);
/*?Check?the?end?of?ADC1?reset?calibration?register?*/
while(ADC_GetResetCalibrationStatus(ADC1));
/*?Start?ADC1?calibaration?*/
ADC_StartCalibration(ADC1);
/*?Check?the?end?of?ADC1?calibration?*/
while(ADC_GetCalibrationStatus(ADC1));
/*?Start?ADC1?Software?Conversion?*/?
ADC_SoftwareStartConvCmd(ADC1?ENABLE);?//使能ADC軟件啟動功能
Delay(10000);?//3或者4選擇不同通道采集結果
AD_value[i]=?ADC_GetConversionValue(ADC1); //返回最近一次ADCx規(guī)則組的轉換結果
AD_value[i]=AD_value[i]*?V_REF?/(0xfff); ?
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2433??2013-09-12?18:42??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\adc.c
?????文件????????143??2013-05-03?21:12??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\adc.h
?????文件??????15738??2013-09-15?15:56??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\app.c
?????文件???????3517??2013-05-18?20:49??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\app_cfg.h
?????文件???????3660??2009-11-27?09:33??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\config.h
?????文件????????610??2013-05-18?12:24??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\DEMO.h
?????文件???????4017??2013-09-15?15:56??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\fsmc_sram.c
?????文件???????1608??2009-11-16?13:45??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\fsmc_sram.h
?????文件??????19515??2013-09-12?18:46??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\Fun.c
?????文件???????2129??2011-09-05?12:55??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\includes.h
?????文件?????960932??2013-05-18?20:53??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\Jli
?????文件????????573??2013-04-11?16:19??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\Jli
?????文件??????10436??2011-07-07?09:53??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\os_cfg.h
?????文件???????4796??2013-09-14?12:03??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\PID.c
?????文件????????687??2013-07-18?09:12??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\PID.h
?????文件???????2369??2011-09-21?09:07??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\platform_config.h
?????文件???????5460??2013-09-12?18:56??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\pwmzhiliu.c
?????文件??????77055??2013-09-12?18:53??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\pwmzhiliu.cPreview
?????文件????????226??2013-04-24?17:22??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\pwmzhiliu.h
?????文件???????1257??2009-06-29?16:13??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\RAM.ini
?????文件???????7708??2012-10-15?10:43??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui.opt.bak
?????文件???????4745??2012-10-15?09:11??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui.Uv2.bak
????.......????275042??2013-09-15?15:58??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui.uvgui.Administrator
????.......?????70511??2013-09-15?17:33??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui.uvgui.lhl
????.......????480171??2013-05-18?20:53??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui.uvgui.lsl
????.......????275039??2013-09-15?15:58??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui.uvgui_Administrator.bak
????.......????479970??2013-05-18?12:38??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui.uvgui_lsl.bak
????.......?????31398??2013-09-15?15:58??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui.uvopt
????.......?????24039??2013-09-12?19:57??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui.uvproj
?????文件?????103333??2011-09-21?09:19??智能水產(chǎn)養(yǎng)殖系統(tǒng)\APP\STM32-FD-ucgui_Flash.dep
............此處省略225個文件信息
評論
共有 條評論