CodeWarrior MC9S08SF4 ADC Number of Conversions

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CodeWarrior MC9S08SF4 ADC Number of Conversions

Jump to solution
556 Views
JimmyJames
Contributor I

CodeWarrior MC9S08SF4 ADC Number of Conversions

 

I am new to both Freescale & CodeWarrior - & loving it.

 

When setting the ADC component's "Number of Conversions", through the Component Inpector, does the code generated averages the result, or do you have to do that yourself. I looked at the generated code, but it didn't seem obvious where is it that they are calculating the average of the measurements. Since this is how the measurements are saved,

 

  RefSense_OutV[SumChan] += tmpTwreg.w; /* Save measured value */

 

But when it reaches the number of conversions, then it invokes the user event, 

 

      RefSense_OnEnd();                /* Invoke user event */  

  

However, nowhere can I see where the aveage of the measurements is being calculated.

 

Thanks.  

Labels (1)
Tags (1)
0 Kudos
1 Solution
382 Views
Jim_P
Contributor III

they are doing this smart.

 

for some systems, the boucing up and down between values can be of importance.

 

to get the ADC averaged value simply divide by the number of conversions.

 

to get a floating point value that has the resulting do floating point math. for the devide.

this acts to filter out the noise and give you the fractional remainder as fraction of a bit.

 

Jim P

View solution in original post

0 Kudos
1 Reply
383 Views
Jim_P
Contributor III

they are doing this smart.

 

for some systems, the boucing up and down between values can be of importance.

 

to get the ADC averaged value simply divide by the number of conversions.

 

to get a floating point value that has the resulting do floating point math. for the devide.

this acts to filter out the noise and give you the fractional remainder as fraction of a bit.

 

Jim P

0 Kudos