你好,Erwan,
参考下面的邮件,我为SPC560D30L1配置了一个ADC通道。我正在使用设置为。我已将回调配置为读取ADC计数并将其转换为电压值。在这里,我观察到需要启动ADC转换(ADC_Start_Conversion)以读取新的输入值。我是在按键上做的。如何配置ADC以进行连续读取并在输入更改时获取更新的计数值?
请注意,我需要相互独立的3-4个ADC通道,我需要类似的功能。怎么实现这个?
在此先感谢您的帮助。
麦克风。
请在下面找回回调,
/ *
* ADC流回调,名称在ADC图形中定义
*配置。
* /
size_t nx = 0,ny = 0;
void ADC_conversion_callback(ADCDriver * adcp,adcsample_t * buffer,size_t n)
{
(空隙)ADCP;
if(samples == buffer)
{
nx + = n;
}
其他
{
ny + = n;
}
g_adc_val = samples [0];
g_adc_vol =((5.0 / 4096)* g_adc_val);
}
/ *
* ADC错误回调,名称在ADC图形中定义
*配置。
* /
uint32_t errore = 30;
void ADC_error_callback(ADCDriver * adcp,adcerror_t err)
{
(空隙)ADCP;
错误=错误;
osalSysHalt(''ADC失败'');
}
以上来自于谷歌翻译
以下为原文
Hello Erwan,
Referring to below mail, I have configured an ADC channel for SPC560D30L1. I am using with set to . I have configured the callbacks to read the ADC count and to convert it to voltage value. Here, I have observed that ADC conversion is required to be initiated (ADC_Start_Conversion) in order to read the new input value. I am doing this on a key press. How can I configure the ADC for continuous read and get the updated count value when input changes?
Please note that I have 3-4 more ADC channels independent of each other where I required similar functionality. How to implement this?
Thanks in advance for your help.
Mike.
Please find below the callbacks,
/*
* ADC streaming callback, the name is defined in the ADC graphic
* configuration.
*/
size_t nx = 0, ny = 0;
void ADC_conversion_callback (ADCDriver *adcp, adcsample_t *buffer, size_t n)
{
(void)adcp;
if (samples == buffer)
{
nx += n;
}
else
{
ny += n;
}
g_adc_val = samples[0];
g_adc_vol = ((5.0/4096)*g_adc_val);
}
/*
* ADC error callback, the name is defined in the ADC graphic
* configuration.
*/
uint32_t errore = 30;
void ADC_error_callback (ADCDriver *adcp, adcerror_t err)
{
(void)adcp;
errore = err;
osalSysHalt(''ADC failure'');
}
你好,Erwan,
参考下面的邮件,我为SPC560D30L1配置了一个ADC通道。我正在使用设置为。我已将回调配置为读取ADC计数并将其转换为电压值。在这里,我观察到需要启动ADC转换(ADC_Start_Conversion)以读取新的输入值。我是在按键上做的。如何配置ADC以进行连续读取并在输入更改时获取更新的计数值?
请注意,我需要相互独立的3-4个ADC通道,我需要类似的功能。怎么实现这个?
在此先感谢您的帮助。
麦克风。
请在下面找回回调,
/ *
* ADC流回调,名称在ADC图形中定义
*配置。
* /
size_t nx = 0,ny = 0;
void ADC_conversion_callback(ADCDriver * adcp,adcsample_t * buffer,size_t n)
{
(空隙)ADCP;
if(samples == buffer)
{
nx + = n;
}
其他
{
ny + = n;
}
g_adc_val = samples [0];
g_adc_vol =((5.0 / 4096)* g_adc_val);
}
/ *
* ADC错误回调,名称在ADC图形中定义
*配置。
* /
uint32_t errore = 30;
void ADC_error_callback(ADCDriver * adcp,adcerror_t err)
{
(空隙)ADCP;
错误=错误;
osalSysHalt(''ADC失败'');
}
以上来自于谷歌翻译
以下为原文
Hello Erwan,
Referring to below mail, I have configured an ADC channel for SPC560D30L1. I am using with set to . I have configured the callbacks to read the ADC count and to convert it to voltage value. Here, I have observed that ADC conversion is required to be initiated (ADC_Start_Conversion) in order to read the new input value. I am doing this on a key press. How can I configure the ADC for continuous read and get the updated count value when input changes?
Please note that I have 3-4 more ADC channels independent of each other where I required similar functionality. How to implement this?
Thanks in advance for your help.
Mike.
Please find below the callbacks,
/*
* ADC streaming callback, the name is defined in the ADC graphic
* configuration.
*/
size_t nx = 0, ny = 0;
void ADC_conversion_callback (ADCDriver *adcp, adcsample_t *buffer, size_t n)
{
(void)adcp;
if (samples == buffer)
{
nx += n;
}
else
{
ny += n;
}
g_adc_val = samples[0];
g_adc_vol = ((5.0/4096)*g_adc_val);
}
/*
* ADC error callback, the name is defined in the ADC graphic
* configuration.
*/
uint32_t errore = 30;
void ADC_error_callback (ADCDriver *adcp, adcerror_t err)
{
(void)adcp;
errore = err;
osalSysHalt(''ADC failure'');
}
举报