Regarding that iterative algorithm to convert AD8307 ADC readings into voltsRF:
toggle quoted message
Show quoted text
We only need two calibration constants stored, perhaps the nominal 0.025v/dB and 100vrms full scale. It's the standard slope+intercept model. Can be calibrated by taking two readings of two different known power levels into 50 ohms. Can get by with as few as 2 integer bits for voltsADC (max of around 2.50), so can have 30 fractional bits there since using 32 bit fixed point math. (Complicates the flip to negative values when we have no sign bit, but easily do-able.) The voltsRF could have as few as 7 integer bits if we assume a max of 128 volts rms there, so 25 fractional bits.? I'm going for maximum fractional bits to minimize rounding errors from that iterative processes, we can be plenty accurate in that regard.? But this algorithm will not work with 16 bit fixed point on either voltsRF or voltsADC. The first loop likely wants the ratio between iterations to be 31/32 rather than 1/2, this makes the number of passes through the first loop be roughly the same as the passes through the second loop. Ratio for the second loop can remain at 4097/4096. Could add an extra loop or two, reducing iteration counts further, but I doubt that's necessary.? I'll be very surprised if this takes more than a few milliseconds to complete. Only executes during transmit when nothing much else is going on so doesn't really matter, and we can check PTT within the loops and abort the computation when it goes away. Flash usage should be quite minimal, best guess is maybe a couple hundred bytes. A 10 bit ADC with 5v fullscale reading the AD8307 is marginal but might be useful. Assuming we really have 10 bits, an LSB change represents? 5v/1024=0.00488v, and given the 0.025v/dB slope of the AD8307 that's? 0.00488v/0.025 = 0.195 dB. A power ratio of? ?10**(0.195/10) = 1.046.? So can measure power within 5% or so. A much better choice would be a 12 bit ADC with a fullscale of 2.5v, Power ratio for an LSB change is? ?10**(((2.5v/4096)/0.025)/10) = 1.0056, So within better than 1% if we really have 12 bits. Ok, I'm going to park this right here for now.? But I am now convinced that reading a couple AD8307's?and then computing Watts and SWR should be easy enough on the Nano,?and take up very little flash or RAM.? Jerry, KE7ER On Wed, May 9, 2018 at 10:20 am, Jerry Gaffke wrote:
|