Help using the log/antilog lookup
frank freedman
Posts: 1,983
I have just tried to stuff the input samples of my ADC engine through the log table look up routine shown in the propman V1.1 p382-3. The result using a linear triangle wave of ~4khz input resulted in the same linear output. I had expected to see a somewhat logarithmic curve rather than linear. This is with a 12 bit pretty much full scale 0-Vref triangle wave input. Not sure if this is reasonable and would get more pronounced curvature output if the table was ln, (assumed log as it isn't called ln table).
Somewhat hesitant to mark solved/unsolved as this is new territory for me (at least in the digital world).
Thanks
Frank
Somewhat hesitant to mark solved/unsolved as this is new territory for me (at least in the digital world).
Thanks
Frank
Comments
I'm attaching a little demo program I wrote to explore the use of the tables and also a parallel computation of the bitlog function (a fast approximation to the logarithm). Maybe it will help. The program uses a debug terminal on the PC (Parallax Serial Terminal) or the Mac/PC/Linux (BST serial), and you enter numbers as a numerator and denominator of a fraction, and the program spits out the base 2 and base 10 logarithms (and bitlogs) of both numbers and the ratio. The values in the HUB table are log base 2.
DC offset was set so negative excursion was at 0 VDC wrt system GND. P-P triangle or sine wave was set to 4.8 V with Vref tied to VCC. Initially the digital output was passed out to an R2R DAC and the levels were verified to be in range as output showed no flattening at the 0 point or clipping at the max input. Also when in the low Khz range there was minimal phase shift noted and enough samples taken for a fairly smooth representation of the waveform. The function gen does need cal so these levels are checked at whatever freq range and dial setting I am on. Once the pass through was verified, then I tried to push the data through a log subroutine. I was just surprised by the lack of effect.
I have not got it right yet, so I may turn it into a single capture function again and pass the values out through fdxserial and see what they look like under open office spreadsheet as I did with my initial testing. I did put the modular object in the OBEX, though without any filters at all. The log will be the first filter to add to the mix.
Thanks,
Frank