0

Background: I am dealing with reverse engineering a software. And trying to understand a formula in the code.

I found a formula that reads:

pga_gain = pow (10.0, agc / 20.0);

In the above formula what are 10.0 and 20.0. 10 seems to be the log10 base. Is that correct? In any case I would appreciate if someone could give me the names of those magic numbers in that formula.

thanks.

1 Answers1

4

This is almost certainly a conversion between dB, and linear gain.

pga_gain (linear) = 10**(agc/20) (with agc expressed in dB)

When going the other way, the formula is gain(dB) = 20 * log10(linear_gain)

Read all about dB units here. In summary, Bell Labs started using powers of 10, which were too big to be convenient, so now we use deciBells, or dB. A rather better article pointed out by Curd in his comment is this one.

The multiplier is 10 for power ratio, and 20 for the voltage ratio. When you are measuring amplifier or attenuator gain, you use voltage ratio.

Neil_UK
  • 158,152
  • 3
  • 173
  • 387