Defines | Functions

adc_filtr.c File Reference

#include <lpc21xx.h>
#include <types.h>
#include "adc_filtr.h"
#include <stdlib.h>
#include <string.h>
#include <deb_led.h>
Include dependency graph for adc_filtr.c:

Defines

#define ADCCH0   22
 ADC0 value for PINSEL.
#define ADCCH1   24
 ADC1 value for PINSEL.
#define ADCCH2   26
 ADC2 value for PINSEL.
#define ADCCH3   28
 ADC3 value for PINSEL.

Functions

int compare (const void *a, const void *b)
 Comparsion function for quicksort.
void adc_filter (unsigned char chan)
 Median filter for ADC.
void adc_isr_filtr (void)
 ADC ISR routine.
void init_adc_filter (unsigned rx_isr_vect)
 Inicializes ADC service for all ADC (4) channels and installs ISR routine to VIC.

Define Documentation

#define ADCCH0   22

ADC0 value for PINSEL.

#define ADCCH1   24

ADC1 value for PINSEL.

#define ADCCH2   26

ADC2 value for PINSEL.

#define ADCCH3   28

ADC3 value for PINSEL.


Function Documentation

void adc_filter ( unsigned char  chan  ) 

Median filter for ADC.

If new data is available the median is recalculated. This function may be called from main function, it should take long time to calculate the median for all ADC value.

Parameters:
chan bit oriented (0~3) value, defines which ADC channels have new data

Here is the call graph for this function:

Here is the caller graph for this function:

void adc_isr_filtr ( void   ) 

ADC ISR routine.

This routine reads selected ADC value and multiplies it by ADC_MUL and adds ADC_OFFSET to calculate the volage (3.25mV/div). After this reading the next ADC channel is set up for measuring.

Here is the caller graph for this function:

int compare ( const void *  a,
const void *  b 
)

Comparsion function for quicksort.

Parameters:
*a first number for comparion
*b second number for comparion
Returns:
1 if b is higher than a

Here is the caller graph for this function:

void init_adc_filter ( unsigned  rx_isr_vect  ) 

Inicializes ADC service for all ADC (4) channels and installs ISR routine to VIC.

Automaticly starts the conversion of first channel on given conversion frequency.

Here is the call graph for this function:

Here is the caller graph for this function: