e_ad_conv.h File Reference

Module for the advance Analogic/Digital conversion. More...


Defines

#define MIC_SAMP_FREQ   16384.0
#define ACC_PROX_SAMP_FREQ   256.0
#define PULSE_LENGHT   0.0003
#define ACC_PROX_PERIOD   (int)(MIC_SAMP_FREQ/ACC_PROX_SAMP_FREQ)
#define PULSE_PERIOD   (int)(PULSE_LENGHT*MIC_SAMP_FREQ)
#define ADCS_3_CHAN   (int)(2.0*FCY/(MIC_SAMP_FREQ*(14+1)*3)-1)
#define ADCS_5_CHAN   (int)(2.0*FCY/(MIC_SAMP_FREQ*(14+1)*5)-1)
#define ADCS_6_CHAN   (int)(2.0*FCY/(MIC_SAMP_FREQ*(14+1)*6)-1)
#define MIC_SAMP_NB   256
#define ACC_SAMP_NB   50
#define MICRO_ONLY   1
#define ALL_ADC   0

Functions

void e_init_ad_scan (unsigned char only_micro)
 Initialize all the A/D register needed.
unsigned char e_ad_is_array_filled (void)
 To know if the ADC acquisitionn of microphone only is completed.
unsigned char e_ad_is_acquisition_completed (void)
 To know if the ADC acquisitionn is completed.
void e_ad_scan_on (void)
 Enable the ADC conversion.
void e_ad_scan_off (void)
 Disable the ADC conversion.


Detailed Description

Module for the advance Analogic/Digital conversion.

The advance converter module is set to operate by itself. It uses the ADC interrupt to launch the acquisitions. Then no timer is needed.

The data sampled are stored in the corresponding array:

In all the files of this module (e_acc.c, e_micro.c, e_prox.c), these arrays are declared has "extern". In this way we can access the arrays for exemple like this (function e_get_acc from e_acc.c):

 extern int e_acc_scan[3][ACC_SAMP_NB];

 int e_get_acc(unsigned int captor)
 {
        if (captor < 3)
                return (e_acc_scan[captor][e_last_acc_scan_id]);
        else
                return((int)ANGLE_ERROR);       
 }
Author:
Code: Francesco Mondada, Michael-Bonani & Borter Jean-Joel
Doc: Jonathan Besuchet

Define Documentation

#define ACC_PROX_PERIOD   (int)(MIC_SAMP_FREQ/ACC_PROX_SAMP_FREQ)

#define ACC_PROX_SAMP_FREQ   256.0

#define ACC_SAMP_NB   50

#define ADCS_3_CHAN   (int)(2.0*FCY/(MIC_SAMP_FREQ*(14+1)*3)-1)

#define ADCS_5_CHAN   (int)(2.0*FCY/(MIC_SAMP_FREQ*(14+1)*5)-1)

#define ADCS_6_CHAN   (int)(2.0*FCY/(MIC_SAMP_FREQ*(14+1)*6)-1)

#define ALL_ADC   0

#define MIC_SAMP_FREQ   16384.0

#define MIC_SAMP_NB   256

#define MICRO_ONLY   1

#define PULSE_LENGHT   0.0003

#define PULSE_PERIOD   (int)(PULSE_LENGHT*MIC_SAMP_FREQ)


Function Documentation

unsigned char e_ad_is_acquisition_completed ( void   ) 

To know if the ADC acquisitionn is completed.

Returns:
0 if the new acquisition is not made, 1 if completed.

unsigned char e_ad_is_array_filled ( void   ) 

To know if the ADC acquisitionn of microphone only is completed.

Returns:
0 if the new acquisition is not made, 1 if completed.

void e_ad_scan_off ( void   ) 

Disable the ADC conversion.

void e_ad_scan_on ( void   ) 

Enable the ADC conversion.

void e_init_ad_scan ( unsigned char  only_micro  ) 

Initialize all the A/D register needed.

Set up the different ADC register to process the AD conversion by scanning the used AD channels. Each value of the channels will be stored in a different AD buffer register and an inturrupt will occure at the end of the scan.

Parameters:
only_micro Put MICRO_ONLY to use only the three microphones at 33kHz. Put ALL_ADC to use all the stuff using the ADC.


Generated on Fri Feb 29 14:26:53 2008 for e-puck by  doxygen 1.5.4