TWR-K60N512-KEIL Freescale Semiconductor, TWR-K60N512-KEIL Datasheet - Page 173

no-image

TWR-K60N512-KEIL

Manufacturer Part Number
TWR-K60N512-KEIL
Description
K60N512 Keil Tower Kit
Manufacturer
Freescale Semiconductor
Series
Kinetisr
Type
MCUr

Specifications of TWR-K60N512-KEIL

Rohs Compliant
YES
Contents
4 Boards, Documentation, DVD
Peak Reflow Compatible (260 C)
Yes
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
For Use With/related Products
Freescale Tower System, K60N512
18.2.1.8 Software triggering of PDB
Software trigger the PDB:
The system is now working. The PDB is continuously triggering ADC conversions. Now,
to display the results. The line above was the SOFTWARE TRIGGER...
18.2.1.9 Handle ADC and PDB interrupts
Interrupt servicing is simple; even the digital filter is only two lines of C code. It is placed
in both ADC1A and ADC1B portions of the ISR.
/******************************************************************************
* adc1_isr(void)
*
* use to signal ADC1 end of conversion
* In:
* Out: exponentially filtered potentiometer reading!
* The ADC1 is used to sample the potentiometer on the A side and the B side:
* ping-pong.
exponentially_filtered_result1
* thus the filtered POT output is available for display.
******************************************************************************/
void adc1_isr(void)
{
conversions just triggered
flag
This is the exponential filter portion for ADC1A:
effect
These cycle flags are used to keep track of which results are available at the program
level.
This is the exponential filter portion for ADC1B:
effect
Freescale Semiconductor
PDB_SC |= PDB_SC_SWTRIG_MASK ;
if (( ADC1_SC1A & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK) {
else if (( ADC1_SC1B & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK) {
PIN2_HIGH
result1A = ADC1_RA;
// Begin exponential filter code for Potentiometer setting for demonstration of filter
exponentially_filtered_result1 += result1A;
exponentially_filtered_result1 /= 2 ;
// Spikes are attenuated 6dB, 12dB, 24dB, .. and so on until they die out.
// End exponential filter code..
}
PIN2_LOW
result1B = ADC1_RB;
// Begin exponential filter code for Potentiometer setting for demonstration of filter
exponentially_filtered_result1 += result1B;
exponentially_filtered_result1 /= 2 ;
// Spikes are attenuated 6dB, 12dB, 18dB, .. and so on until they die out.
// End exponential filter code..
cycle_flags |= ADC1A_DONE ;
n/a
Chapter 18 Using Peripheral Delay Block (PDB) to Schedule Analog to Digital Converter (ADC) Conversions
That reading is filtered for an aggregate of ADC1 readings:
Kinetis Quick Reference User Guide, Rev. 0, 11/2010
// do this asap
// this will clear the COCO bit that is also the interrupt
// mark this step done
// kick off the PDB
add f*sample, divide by (f+1).. f is 1 for this case.
add f*sample, divide by (f+1).. f is 1 for this case.
- just once
// check which of the two
173

Related parts for TWR-K60N512-KEIL