/*** HEADER *******************************************************************/
/*                                                                            */
/* File:   adc.h                                                              */
/* Author:                                             			      */
/*                                                                            */
/*** NOTES ********************************************************************/
/*                                                                            */
/* Tris-Register must be set to configure Portpins as an input (default)!     */
/*                                                                            */
/*** DEFINES  *****************************************************************/

#ifndef adc_h                       // conditional inclusion
#define adc_h

#define MEASUREMENTS       50       // measurements*8/CHANNELS to compute the rms
#define CHANNELS            1       // number of channels

#define MIN                20       // minimal value to detect signal
#define nMIN                4       // n times MIN has to be detected
#define nMIN_TO_ABORT   65000       // n times without detected signal to abort the measurement

/*** GLOBAL-VAR ***************************************************************/

extern int adc_buffer[MEASUREMENTS*8/CHANNELS];
extern int adc_time[MEASUREMENTS/CHANNELS][1];
//extern int adc_time;
extern volatile int measurement_done;

/*** FUNCTION-PROTOTYPES ******************************************************/

inline void init_adc(void);        // initialize A/D-Converter

/******************************************************************************/

#endif
