lpc55s69 ADC software trigger

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

lpc55s69 ADC software trigger

跳至解决方案
997 次查看
sanders7284
Contributor III

Hello, I am using the config tools and SDK to set up an ADC instance, the tools has a pop out window that says "software triggers are available" just wondering if anyone can point me towards a worked example please, I want to call a sample from within a loop. 

标签 (2)
0 项奖励
回复
1 解答
992 次查看
sanders7284
Contributor III

I have figured this out, for reference should anyone else need this:-

uint32_t read_adc()
{
lpadc_conv_result_t config;

LPADC_DoSoftwareTrigger(ADC0, 1); //trigger ADC read
while (!LPADC_GetConvResult(ADC0, &config, 0U)){}; //wait for result
return (uint32_t) config.convValue; //return data
}

 

在原帖中查看解决方案

0 项奖励
回复
1 回复
993 次查看
sanders7284
Contributor III

I have figured this out, for reference should anyone else need this:-

uint32_t read_adc()
{
lpadc_conv_result_t config;

LPADC_DoSoftwareTrigger(ADC0, 1); //trigger ADC read
while (!LPADC_GetConvResult(ADC0, &config, 0U)){}; //wait for result
return (uint32_t) config.convValue; //return data
}

 

0 项奖励
回复