Problems with the ADC channels reading KL25Z.

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problems with the ADC channels reading KL25Z.

ソリューションへジャンプ
2,318件の閲覧回数
josealonsovalle
Contributor III

Hi, i have been trying to read the ADC in the FRDM KL25, i can't read the channel ADC0_SE7b(PDT6) and ADC0_SE6b (PTD5),with other channels if i can read the ADC, but only with the PDT5 and PTD6 i had having problems.

Can somebody support me please???

this is my code.

Capture.PNG.png

greetings.

ラベル(2)
1 解決策
1,314件の閲覧回数
mjbcswitzerland
Specialist V

Jose

if you want to sample ADC0_SE7b rather than ADC0_SE7a (which your code is doing) set the MUX selection bit to B in the ADC0_CFG2 register.

That is, add

ADC0_CFG2 |= 0x10;

after

ADC0_SC1A = ADC_SC1_ADCH(31);

For ADC0_SE6b the same MUX bit must be set (there is no ADC0_SE6a input on your device).

Regards

Mark

http://www.utasker.com/kinetis.html

P.S: The uTasker project also includes DMA driven ADC/DAC drivers for KL devices!

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,315件の閲覧回数
mjbcswitzerland
Specialist V

Jose

if you want to sample ADC0_SE7b rather than ADC0_SE7a (which your code is doing) set the MUX selection bit to B in the ADC0_CFG2 register.

That is, add

ADC0_CFG2 |= 0x10;

after

ADC0_SC1A = ADC_SC1_ADCH(31);

For ADC0_SE6b the same MUX bit must be set (there is no ADC0_SE6a input on your device).

Regards

Mark

http://www.utasker.com/kinetis.html

P.S: The uTasker project also includes DMA driven ADC/DAC drivers for KL devices!

0 件の賞賛
返信
1,314件の閲覧回数
avnergidron
Contributor III

Hi Mark,

Maybe you will be able to help me. I  am  new to FS.

I am using KDS and the PE on the same board and I  am facing the same problem. how  can  I read the ADC0_SE7b? (I understood I will need to change the mux but I am not sure how to do it in real time)

Thanks,

Avner

0 件の賞賛
返信
1,314件の閲覧回数
mjbcswitzerland
Specialist V

Avne

What do you mean with real-time?

To switch the input mux between a and b

ADC0_CFG2 &= ~0x10;

and

ADC0_CFG2 |= 0x10;

is all that is needed.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

KL25: http://www.utasker.com/kinetis/FRDM-KL25Z.html / http://www.utasker.com/kinetis/TWR-KL25Z48M.html

ADC/DAC: http://www.utasker.com/docs/uTasker/uTaskerADC.pdf

For the complete "out-of-the-box" Kinetis experience and faster time to market

1,314件の閲覧回数
josealonsovalle
Contributor III

Thanks Mark, my program is working now, i don't know why my program was not function when i had ADC0_CFG2 |= ADC_CFG2_MUXSEL_MAKS; but when i indicated the direction in HEX the program coming to function correctly. 

0 件の賞賛
返信