atabac_2000
Joined: 21 Apr 2004 Posts: 10
|
question on ex_rmsdb.c |
Posted: Wed Aug 08, 2007 6:20 am |
|
|
Hi,
Had anyone toyed around ex_rmsdb.c? There's a line of code that tells:
Code: |
void main() {
const long NUM_DATA_POINTS = 3000;
long i;
int value;
float voltage;
printf("Sampling:\r\n");
setup_port_a( ALL_ANALOG );
setup_adc( ADC_CLOCK_INTERNAL );
set_adc_channel( 1 );
while(TRUE)
{
voltage = 0;
for(i=0; i<NUM_DATA_POINTS; ++i)
{
value = Read_ADC();
voltage += (float)value*(float)value;
}
voltage /=2601.0;
voltage = sqrt(voltage/(NUM_DATA_POINTS));
printf("\r\nInput = %f V %f dB\r\n", voltage, 20*log10(voltage));
}
}
|
I wonder what's the 2601.0 for? |
|