資源簡介
用STM8S003單片機最小系統ADC功能采樣0-4V 100Hz正弦波數據,并計算正弦波平均值。通過三種不同的采樣方法,對比采樣的平均值差異。
代碼片段和文件信息
#include?“iostm8s103F3.h“
#include?“main.h“
#include?“led.h“
#include?“adc.h“
#include?“stdio.h“
#include?“delay.h“
#include?“stdlib.h“
/*
單片機引腳定義
PD3?--------------??0--5V輸入
PD2?--------------??副邊電流采樣輸入端?0--300mA
PC6?--------------??PWM?功率控制輸出
PC4?--------------??溫度檢測
PC3?--------------??驅動芯片供電控制
PA3?--------------??保護信號輸入
*/
void?SysClkInit(?void?)
{
????CLK_SWR?=?0xe1;?????????????????????????????//HSI為主時鐘源??16MHz?CPU時鐘頻率
????CLK_CKDIVR?=?0x00;??????????????????????????//CPU時鐘0分頻,系統時鐘0分頻
}
void?main(?void?)
{
????u16?val1?=?0val2=0;
????__asm(?“sim“?);?????????????????????????????//禁止中斷
????SysClkInit();
????delay_init(?16?);
????LED_GPIO_Init();
????ADC_GPIO_Init();
????__asm(?“rim“?);?????????????????????????????//開啟中斷
????while(?1?)
????{
??????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-04-11?15:35??Adc_Ave_Test\
?????文件????????2397??2018-05-15?14:52??Adc_Ave_Test\BuildLog.log
?????目錄???????????0??2019-04-10?16:16??Adc_Ave_Test\Debug\
?????目錄???????????0??2019-04-11?15:35??Adc_Ave_Test\Debug\Exe\
?????文件????????4252??2019-04-11?15:24??Adc_Ave_Test\Debug\Exe\power_soft.hex
?????文件???????51052??2019-04-11?15:24??Adc_Ave_Test\Debug\Exe\power_soft.out
?????目錄???????????0??2019-04-11?15:35??Adc_Ave_Test\Debug\List\
?????文件???????19165??2019-04-11?15:24??Adc_Ave_Test\Debug\List\power_soft.map
?????目錄???????????0??2019-04-15?09:15??Adc_Ave_Test\Debug\Obj\
?????文件???????40976??2019-04-11?15:02??Adc_Ave_Test\Debug\Obj\adc.o
?????文件??????234152??2019-04-11?15:31??Adc_Ave_Test\Debug\Obj\adc.pbi
?????文件???????11699??2019-04-11?15:31??Adc_Ave_Test\Debug\Obj\adc.pbi.xcl
?????文件????????8539??2019-04-10?16:48??Adc_Ave_Test\Debug\Obj\delay.o
?????文件????????1638??2019-04-10?16:48??Adc_Ave_Test\Debug\Obj\delay.pbi
?????文件???????11701??2019-04-10?16:48??Adc_Ave_Test\Debug\Obj\delay.pbi.xcl
?????文件???????15979??2019-04-10?16:48??Adc_Ave_Test\Debug\Obj\led.o
?????文件??????225804??2019-04-10?16:48??Adc_Ave_Test\Debug\Obj\led.pbi
?????文件???????11699??2019-04-10?16:48??Adc_Ave_Test\Debug\Obj\led.pbi.xcl
?????文件????????7653??2019-04-11?15:24??Adc_Ave_Test\Debug\Obj\main.o
?????文件??????274524??2019-04-11?15:24??Adc_Ave_Test\Debug\Obj\main.pbi
?????文件???????11691??2019-04-11?15:24??Adc_Ave_Test\Debug\Obj\main.pbi.xcl
?????文件??????282815??2019-04-15?09:15??Adc_Ave_Test\Debug\Obj\power_soft.pbd
?????文件??????282815??2019-04-15?09:15??Adc_Ave_Test\Debug\Obj\power_soft.pbd.browse
?????文件?????????228??2019-04-15?09:15??Adc_Ave_Test\Debug\Obj\power_soft.pbd.linf
?????目錄???????????0??2019-04-11?15:35??Adc_Ave_Test\HardWare\
?????文件????????7631??2019-04-11?15:31??Adc_Ave_Test\HardWare\adc.c
?????文件????????7282??2019-04-11?14:57??Adc_Ave_Test\HardWare\adc.c.orig
?????文件?????????353??2019-04-11?14:49??Adc_Ave_Test\HardWare\adc.h
?????文件????????2656??2018-10-11?14:45??Adc_Ave_Test\HardWare\delay.c
?????文件?????????375??2018-05-29?14:27??Adc_Ave_Test\HardWare\delay.h
?????文件?????????766??2019-03-30?13:09??Adc_Ave_Test\HardWare\led.c
............此處省略27個文件信息
評論
共有 條評論