ADC on FRDM-KL03Z

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,603件の閲覧回数
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 解決策
1,367件の閲覧回数
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 返答(返信)
1,367件の閲覧回数
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 件の賞賛
返信
1,367件の閲覧回数
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 件の賞賛
返信
1,368件の閲覧回数
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 件の賞賛
返信