#include <lpc21xx.h>
#include <types.h>
#include "adc_filtr.h"
#include <stdlib.h>
#include <string.h>
#include <deb_led.h>
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 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.
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.
chan | bit oriented (0~3) value, defines which ADC channels have new data |
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.
int compare | ( | const void * | a, | |
const void * | b | |||
) |
Comparsion function for quicksort.
*a | first number for comparion | |
*b | second number for comparion |
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.