AnsweredAssumed Answered

Question to K60 ADCs in use with PDB

Question asked by chn on Mar 12, 2015
Latest reply on Mar 14, 2015 by Mark Butcher



I have a question about using PDB with ADCs on a Kinetis K60.


My system is as follows:

ADC0, A-channel must be converted every 1 ms
ADC1, A-channel must be converted every 10 ms
ADC1, B-channel must be converted every 10 ms


So I initialized PDB for running with 1 ms and enable ADC1 pre-trigger in every 10th PDB interrupt service routine..
It seems to work, but I don't know if this is a safe way to do that. My code for the pdb-isr is as following:


void pdb_isr( void )

  static intx cntPDB = 0;
  if( ++cntPDB == 10 )
    cntPDB = 0;
    PDB0_CH1C1 = PDB_C1_EN(0x01) | PDB_C1_TOS(0x01) | PDB_C1_EN(0x02) | PDB_C1_TOS(0x02);
    PDB0_CH1C1 = 0;
}// end of HwADC_PDBISR()