标题:
ATMEL Samc21 ADC 采集程序
[打印本页]
作者:
taotaoone1221
时间:
2020-8-12 14:40
标题:
ATMEL Samc21 ADC 采集程序
采用的是12位的内部ADC采集程序经过测试可用。
/*
* Systick_timer.c
*
* Created: 2019/4/22 17:41:05
* Author: autonav
*/
#include "Systick_timer.h"
volatile uint32_t systick_ms;
volatile Flag_TypeDef systick_flag;
volatile uint32_t systick_ms;
volatile Flag_TypeDef systick_flag;
void SysTick_Handler(void)
{
systick_ms++;
systick_flag.flag_1ms++;
systick_flag.flag_2ms++;
systick_flag.flag_5ms++;
systick_flag.flag_10ms++;
systick_flag.flag_20ms++;
systick_flag.flag_50ms++;
systick_flag.flag_100ms++;
systick_flag.flag_200ms++;
}
void SysTick_TimerStart()
{
if (SysTick_Config(SystemCoreClock / 1000)) //配置1ms SysTick中断
{
while (1)
{
}
}
}
float64_t SysTick_GetCurrentTime()
{
volatile uint32_t load = SysTick->LOAD;
volatile uint32_t val = SysTick->VAL;
return( (systick_ms+(float64_t)(load-val)/(load+1)) / 1000);
}
float64_t get_dT(float64_t *last_time)
{
float64_t current_time = SysTick_GetCurrentTime();
float64_t dt = current_time - *last_time;
*last_time = current_time;
return(dt);
}
void Delay(uint32_t x)
{
while(x--);
}
复制代码
Adc.7z
2020-8-17 20:57 上传
点击文件名下载附件
下载积分: 黑币 -5
1.27 MB, 下载次数: 13, 下载积分: 黑币 -5
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1