Answers to some occasional questions

Was it your own idea?

No. Definitely not. I stole it from AADE's web site. It looked like a fun project to build one - and it certainly was! There is some evidence that the idea was described by Dr. Hegewald in the (East) German magazine Funkamateur in 1988

Can I use different values of L and C in the oscillator?

Certainly. The program completely compensates for "errors" in L and C. It is quite OK to use, for example L = 100uH and C = 820pF. The only requirement is that the combination have a resonant frequency about 10% to 15 % below 655360Hz.

Note that the Ccal capacitor is critical! (see later comment).

Can I replace the relay with a 2N7000 FET?

This should be possible (with a "slight" change to the program to invert the control signal and a "slight" loss of accuracy).

I did try a NPN transistor in an early version of the prototype, but wasn't happy with the stability. This was probably due mainly to my "rat's nest" construction. My excuse for using a relay is pure laziness - having got it working, I wasn't going to mess with it.

Can I use a different Ccal?

In principle yes, but I think it is easier to parallel a couple of smaller values to get 1000pF (That is if you can't get a 1000pF +/- 0.5% standard capacitor).

You will have to modify the source code in the subroutines Get_Lcal and Get_Ccal to use appropriate constants. I don't want to do this on an individual basis. It's not quite straightforward and I have conveniently forgotten how to do it!

If you want to change Get_Lcal and Get_Ccal, then the following "Floating Point Converter" *may* help you convert a real number into Microchip's 24 bit FP format. Of course, you have to know what value calibration constant you want to use.

I want to assemble your source code but can't find the FP.TXT file!

I didn't want to upset Microchip over copyright of the file, so that's why you won't find a copy on this site.

Go to the Microchip Web Site - http://www.microchip.com find the file FP24.A16 (and/or search for Application Note AN575). Take out the subroutines FLO1624 and INT2416, which aren't used.

What about Software Calibration?

Build the LC Meter V2!

Where can I get a Programmed Chip?

Sorry, I can only help if you live in Australia. Email me.

Help. It does not work!

A lot of these have been built now, sufficient for me to think the design is "reasonably correct". This means that most problems will be incorrect wiring.

First, check the power and ground wiring. You should have +5.0 (+/-0.3) volt present on pin 14 of the PIC and 0 volt present on pin 5 of the PIC.

Next, check the reset wiring ("zero" push button). When the button is released You should have +5 volt present on pin 4 of the PIC and 0 volt when it is pressed.

The circuit diagram does not show the power supply connections to the LM311 (sorry). Connect pins 1 and 4 to ground. Connect pin 8 to the 5 volt power supply.

Some LM311's may not oscillate too readily at "high" frequencies. You can speed them up a little by joining pins 5 and 6 together. It is probably a good idea to do this anyway.

To aid troubleshooting, you should find the following voltages on the pins of the LM311 (measured on the prototype).

Pin 1: 0.00 (ground) Pin 2: 2.46 +/- 0.5 volt Pin 3: 2.46 +/- 0.5 volt Pin 4: 0.00 (ground) Pin 5: ???? (don't care) Pin 6: ???? (don't care) Pin 7: 2.43 +/- 0.5 volt Pin 8: 5.00 (power)

The DC voltages on pins 2, 3 and 7 should appear steady when measured on a "multimeter". If these voltages "bounce around" several times a second, then your inductor may have become disconnected. ie. The parallel LC tuned (1000pF, 82uH) circuit is no longer parallel resonant. Check all the wiring around the LC function switch.

If you have access to an oscilloscope, have a look at this page to see what the LM311 is doing.

Please try the following tests:

    1. Adjust the "contrast" potentiometer (connects to pin 3 of the LCD). See if any characters appear on the display.
    2. Remove the PIC, disconnect the LCD display. Measure the power supply current. It should be al most "several milli-amp". Check that the voltage regulator is delivering 5.00 volt +/- 0.25 volt. This tests the voltage regulator and the power wiring.
    3. With the PIC still removed, short pin 18 of the PIC socket to ground. The relay should "pull-in" with an audible click.
    4. If steps 1 and 2 are OK, remove power, insert the PIC, re-apply power. Check the power supply current. It should be around 5 to 7 mA (maybe a bit more or less). Anything over 20mA indicates a faulty PIC chip.
    5. Press and release the "zero" push button. This resets the PIC. The PIC should then briefly operate the relay (about 0.2 second). If it does not, then the PIC may be faulty. But check the power, ground, reset and relay wiring anyway. Also check that the PIC oscillator is working.
    6. If it is all OK so far, the PIC is probably OK. Connect the LCD display and check the power supply current again. It should be about 16 to 20mA. if it is much higher the LCD display may be faulty. It is most likely OK. Double check that you are connecting the power to the correct part of the display.

Test Mode

To aid initial troubleshooting, the PIC program includes a test mode which is entered by shorting link LK1 and pressing "zero". The PIC will now repeatedly count oscillator cycles for 0.1 second and display the result. With just the 82uH inductor and 1000pF in circuit (no external component, no calibration capacitor), the oscillator will run at about 550KHz and the display will show around 55000

If the frequency is too high (anything over 655.350KHz), the display will show "Over Range". If the oscillator isn't running, the display will show "0".

For best accuracy, the free running frequency should be 10% to 15% below 655KHz. If it is too close, it may accidentally overflow the PIC's internal 16 bit count. You may need to adjust the inductance to get get the frequency right.

A second link, LK2, connects the calibration capacitor. The oscillator should then run at about 394KHz.

What is the "Bad Display" you mention in the main article?

There are at least two varieties of 16 character by one line LCD displays.

One version is logically an 8 character by two line display, but with all the characters displayed on the one line. To cater for this, the PIC program is able to insert a "move to the second line" command (set Display Ram address to 40 hexadecimal) after the eigth character

The PIC tests pin 10 to see wether to insert this command or not. If your display only ever shows 8 characters (ie. no pF, nF or uH as appropriate) then try grounding pin 10 of the PIC ("short" pins of LK3)- or if you are already grounding pin 10, then disconnect it from ground (remove the link).

I don't like your pin assignments - Can I change them?

You can easily change the I/O pin assignments of some of the pins.

  • Any of Port A bits 1,2,3 can be rearranged (they are all outputs)
    • Just edit the lines:
      • #define ENA PORTA,0x02 ; Display "E" #define RS PORTA,0x03 ; Display "RS" #define relay PORTA,0x01 ; 0 = energise relay
    • PORTA,4 can't be moved - the PIC uses that as its timer/counter input.
    • PORTA,0 is difficult to move (too much to change ;-)
  • Any of PORT B bits 4,5,6,7 can be rearranged (they are all inputs)
    • Just edit the lines
      • #define FIXIT PORTB,0x04 ; Pin 10, 0 = "fix bad display" #define setup PORTB,0x06 ; Pin 12, 0 = "Setup" #define functn PORTB,0x07 ; Pin 13, 0 = "Inductor"
    • PORTA,5 is presently not used, but is defined as an input anyway.

(Don't swap inputs with outputs ;-)

What is your #%$@! Email Address?

Sorry to be a bit secretive about this, but it is my anti-spam measure. If you have got this far, it is obvious you are keen. I have a Google Mail address. It is just my ham callsign - all lower case