Is it possible that ADC's all channel(0~15) for k40 use in sequencial conversion mode using a PDB block ?

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

Is it possible that ADC's all channel(0~15) for k40 use in sequencial conversion mode using a PDB block ?

722 次查看
brandonk
Contributor II

HI Everyone

I am writing to inquire the below my K40 ADC Issue.

Is it possible that ADC's all channel(0~15) for k40 use in sequencial conversion mode using a PDB block.

I would explain my intended case in using adc with pdb block which is trigger.

In ADC0,

A channel 0 is started converting by PDB's trigger, If channel 0 is finished conversion,

The next channel 1 is started converting by PDB's trigger, If channel 1 is finished conversion,

The next channel 2 ~

........

The last channel 15 is started converting by PDB's trigger, If channel 15 is finished conversion

The upper works are repeated in same way.

I have been studing the related application note and K40 reference menual.

Please advice me this

Thank you

标记 (3)
1 回复

489 次查看
santiago_lopez
NXP Employee
NXP Employee

Hi Brandon,

I hope you are doing well. It can be done but you will require not only the PDB but also the ADC interrupt for doing this. The PDB can only trigger the ADC conversions but it cannot change the ADC channel being read. What you can do is the following:

1. - Configure your ADC for reading channel 0 (ADCH = 0x00) and hardware trigger to use the PDB

2. - Configure your PDB to trigger the ADC

3. - Configure the ADC interrupt to be called on a conversion complete event (COCO flag is set)

4. - Into the ADC interrupt routine, increase the ADCH value on the ADCx_SC1n register by one

So every time the PDB triggers the ADC, the ADC interrupt will change the channel once the conversion is completed preparing the ADC for the next PDB trigger.

I hope it works. Please let us know how it went.

Best regards