MKM34Z256VLx7 Bare Metal Software Drivers  R4.1.6
Reference Manual
PDB Back-to-Back Trigger

This example shows typical use of the Phase Delay Block (PDB) back to back trigger function in software trigger mode. The PDB module is initially clocked by a BUSCLK. The BUSCLK is 1MHz in this case. PDB counter modulo is configured on 60000 count (the counter overflows after about 60ms). Pre-trigger channel is configured in the delayed mode and channels 2 and 3 are configured in the back to back mode with bypassed delay. Pre-trigger CH0 triggers ADC's CHA (this channel measures ADC single input 8) after a 5ms delay after the PDB SW counter trigger. Conversion complete signal of ADC's CHA is routed to the acknowledgement of PDB's pre-trigger CH1. Pre-trigger CH1 triggers ADC's CHB (this channel measures ADC single input 15.) Conversion complete signal of ADC's CHB is routed to the acknowledgement of PDB's pre-trigger CH2. PDB's Pre-trigger channels are triggered immediately after the conversion complete signal is asserted. When the PDB counter reaches 60000 counts the counter overflows and whole process is repeating.

Source code:
/******************************************************************************
* (c) Copyright 2010-2015, Freescale Semiconductor Inc.
* ALL RIGHTS RESERVED.
******************************************************************************
* pdbb2b_test.c
******************************************************************************/
#include "drivers.h"
static uint16 volatile tmp16[3];
void main (void)
{
/* enable clocks to all on chip peripherals */
/* PDB pre-trigger outputs are connected with the ADC's HW trigger inputs */
/* route the ADC conversion complete signals to the PDB pre-trigger acks */
/* inputs */
0,
NULL);
/* ADC init - HW trigger is selected */
PRI_LVL0, NULL);
/* PDB init - pre trigger channels 0,1,2 are configured. */
/* Trigger the PDB counter */
while (1)
{
if (ADC_Ready(CHA))
{
tmp16[0] = ADC_Read(CHA);
}
if (ADC_Ready(CHB))
{
tmp16[1] = ADC_Read(CHB);
}
if (ADC_Ready(CHC))
{
tmp16[2] = ADC_Read(CHC);
}
}
}
Toolchain support:
IAR EWARM 7.40.7KEIL uVision 5.15CrossWorks 3.6ATOLLIC TrueStudio 5.3.0Kinetis Design Studio 3.0.0