# LC_Meter

Discussion in 'Embedded Systems and Microcontrollers' started by powzoom, Feb 28, 2010.

1. ### powzoom Thread Starter Active Member

Jan 18, 2009
41
0
I'm following the info on http://www.rfcandy.biz/communication/imp_lc.html to build an LC Meter. I have the basic design down and my pic16F690 is reading and displaying both frequencies. My problem is with the math. I need to calculate the formula,

L = 1/(C*(2Pi)^2) * (1/f2^2 - 1/f1^2)

Where the C value is in the pico farads, f is in Mhz and L is in uH. The pic16 doesn't seem to do so well with this calculation. So I need a variable with 18 decimal places?? 2^32 isn't enough. What can I do to get this calculation?

2. ### Markd77 Senior Member

Sep 7, 2009
2,803
594
If you are using assembler, download AN526, AN544, AN617 and AN660 from the microchip site. The precision of these routines could be extended with a bit of headscratching. It is also possible that you could scale some of the variables ie:
if c = 0.0000023
you could replace it with 23 but instead of doing 1/(C*..............) do 1000000/(C....

The chap is only charging 25 euros for a programmed chip which sounds good value.