ADC on FRDM-KL03Z

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

ADC on FRDM-KL03Z

跳至解决方案
816 次查看
steffenwickersh
Contributor I

Hello,

 

i´m trying to initialize the ADC module on the board FRDM-KL03Z with the Kinetis Design Studio + KSDK 1.2.0, but i didn´t found an example which tells me how i should start.. Can everyone help me?

 

Thanks!

标签 (1)
0 项奖励
1 解答
580 次查看
EarlOrlando
Senior Contributor II

Hello Steffen,

The function ADC16_DRV_ConfigConvChn triggers a new conversion if it is configured as software trigger.

The instance is a parameter to differentiate an ADC module when the MCU contains more than one module, in this case there is only one ADC instance (one ADC module) so you need to send a 0.

The ADC has two channel groups, A and B. If you review the KL03Z Reference Manual​ you will see that there are two SC1 registers (ADC0_SC1A and ADC0_SC1B), the chnGroup parameter chooses between these two groups for the same instance. As you are using software trigger you need to choose the group A, that is chnGroup = 0 because the group B is used only for hardware trigger (pages 385/386).

Best regards,

Earl.

在原帖中查看解决方案

0 项奖励
3 回复数
580 次查看
EarlOrlando
Senior Contributor II

Hello Steffen,

The FRDM-KL03Z driver example for the ADC is located in the path C:\Freescale\KSDK_1.2.0\examples\frdmkl03z\driver_examples\adc16. Please take a look into it. If you have doubts I remain at your service.

Best regards,

Earl.

0 项奖励
580 次查看
steffenwickersh
Contributor I

Thank you!

I have a question for this example:

What is the difference between the parameter uint32_t instance and uint32_t chnGroup in the function call:

adc16_status_t ADC16_DRV_ConfigConvChn(uint32_t instance,

    uint32_t chnGroup, const adc16_chn_config_t *configPtr)

My goal is to configure the PTB1 (Pin13) as ADC. Depending on the analog value, a led on pin 14 (PTB2) should light up.

Thanks!

Steffen

0 项奖励
581 次查看
EarlOrlando
Senior Contributor II

Hello Steffen,

The function ADC16_DRV_ConfigConvChn triggers a new conversion if it is configured as software trigger.

The instance is a parameter to differentiate an ADC module when the MCU contains more than one module, in this case there is only one ADC instance (one ADC module) so you need to send a 0.

The ADC has two channel groups, A and B. If you review the KL03Z Reference Manual​ you will see that there are two SC1 registers (ADC0_SC1A and ADC0_SC1B), the chnGroup parameter chooses between these two groups for the same instance. As you are using software trigger you need to choose the group A, that is chnGroup = 0 because the group B is used only for hardware trigger (pages 385/386).

Best regards,

Earl.

0 项奖励