1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Help needed desperately with PIC LCF meter

Discussion in 'General Electronics Chat' started by bigal_scorpio, May 2, 2008.

  1. mrx23

    mrx23 New Member

    Joined:
    Sep 30, 2007
    Messages:
    18
    Likes:
    0
    Unfortunately I don't have any solution for this problem.
    This problem is written here:
    :: EPE Chat Zone *:: *Radio Bygones Message Board ::: LCF meter
    I think it's a problem with the firmware adaptation from 628 to 628A.

    But maybe I know the reason for that:
    When the LCF meter first starts it will store the default frequency values to the EEPROM, and the second start it tries to read them.
    So I think there is a problem with a EEPROM handling with the 628A source code. (628 and 628A have differences in EEPROM HW)

    Try to start up while pressing the Nulling button, it will enter the correction subroutine you can set a number (0-100%) (check the article) and it would store the result in EEPROM, so set the number, SW off, turn back in while pressing the NULL button and check that is the number stored. (not 100 like normally).

    If the problem is not with the EEPROM, than we could put some line in the source code so it will start up in inductance mode.
    Eliminating this error.

    I'm just planning to build this LCF meter.

    You can't measure a cap in circuit! You have to solder out to get an accurate read.
    And you have to keep the measuring wires SHORT!
    Not like in the original article (crocodile clips:)
    You can use ESR incircuit with power off.

    The best way is to put 2 female banana sockets on the instrument.

    It would be awesome to ad an ESR meter to the CLF :D (but it would be very complicated I think)
    And It is not really necessary for hobby, it's for pro servicing.

    I really don't like that the Ext. Freq input is not isolated from the MCU and it's just for 5V TTL. I will do some modification to that (like transistor isolation...)

    How accurate is this devices with 100nF ceramic caps?
     
    Last edited: May 27, 2008
  2. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi again mrx23,

    I didn't mean integrating the ESR into the CFL meter, I reckon it should be a much easier task for someone skilled to just build one as a standalone device.

    As to the lockup problem, I will find out if the "A" is causing the problem later today, as I will program a NON "A" 628 and swap it over!

    While I'm at it I will test some small cap values too.

    See you later...........Al :)
     
  3. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi mrx23,

    Just progged a 628 (notA) and swapped it into the meter and you were right in the assumption of the timeout being caused by the subtle differences between the 628 and 628A.

    Now there is no timeout, the setup loop and even the null loop seems faster too.

    As for testing caps, my strip of 100n tested from 97.75 to 101.5 the strip of 10n tested at 9.765 to 10.3 and the 1ns tested 0.98 to 1.020.

    I also tested some 22ps and they were all between 21 and 22.2.

    Pretty good as far as I can see, I am highly satisfied and now with no timeouts its even better :) Everyone should have one!

    I still think someone should have a go at designing an ESR meter though, they may have been mainly used in a professional capacity (pun intended) at one time but as with most other things when they become cheap enough and readily available then they are adopted by a greater number of the average persons in the street, otherwise we'd still be lighting candles and I'de be chiselling this into a piece of stone in a cave hehehehe.

    So if anyone fancies a challenge!

    All the best.........Al
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.

    CONGRATULATIONS
     
  6. mrx23

    mrx23 New Member

    Joined:
    Sep 30, 2007
    Messages:
    18
    Likes:
    0
    Now we have the source off the problem, we need to eliminate it.
    628A is an upgrade to the 628. It's cheaper and it's easier to get.

    Did you try to Save the calibration (0-100) number? (with the A version)
    We still don't know that is it an EEPROM error.
    Let it automaticaly exit this calibration subroutine (5sec), then power off as I sad.

    Here are the comparisons between the A upgrade and the not A.
    The biggest difference I think is the Timer1. Maybe this is the source of the problem.
    Ericgibbs please could you help?
     

    Attached Files:

  7. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi again,

    mrx23 is a bit formal, whats your name mate?

    I did save the calibration data with the "A" and it held it ok, I had it set at 103% and it was turned on and off many times and retained it ok.

    When I have adjusted the calibration I have never bothered waiting for the routine to time out, I always just adjusted the value and then immediately turned off and then back on, with no problems.

    You are right to ask Eirc for help too, without him I would still be stuck with many of my projects, he is very knowledgable and a great help for us people who are struggling, it was Eric who converted the code to the "A" version for me in the first place, something that was beyond me!

    Anything else that I can help with I will be only too glad to try for you, it would be nice to be able to help for once instead of just being helped, giving something back to this great forum.

    Also thanks Sarma, I appreciate it. :)

    Al
     
  8. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi mrx,
    Downloaded your zip.

    Just to recap,
    Al is saying that the EEPROM is working OK with the 628A version of the program, saving to EEPROM OK.
    [I did not change any of the program, I adjusted the CONFIG]

    Are you saying that with the same program [628A] that Al is using, its not saving to the EEPROM correctly in your project.??

    There are minor differences in the EEPROM sequence between the 628 and the 628A, refer microchip AN576.

    If you would both confirm that the 628A is OK or not, I would be pleased to modify the code.

    I agree with your PIC pin buffer suggestion.

    I have not built this meter.
     
  9. mrx23

    mrx23 New Member

    Joined:
    Sep 30, 2007
    Messages:
    18
    Likes:
    0
    I was just speculating, now I know that the EEPROM is fine on both A/not A.

    The problem is with the Timer1 (pin RB6).
    The pdf says (the A version):
    Timer1 Oscillator designed for 32,768 Khz operation.

    Timer1 Oscillator Speed Change:
    The Timer1 Oscillator is now designed for 32,768 Khz operation.
    In the 628 the Timer1 Oscillator was designed to run up to 200 Khz.

    I think that's why it's so slow.
    Is there any way to solve this?
     
  10. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    Hi,
    I have just completed a thorough testing of the 628 and 628A EEPROM write/reads, using both original code and the 'revised code' for the 628A I cannot find any problems, they both work OK.

    I'll look at the Timer1....
     
  11. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    In the program, TMR0 is the 'event timer' and TMR1 is the counter for the external clock input [RB6] from IC3d/10

    Checked all thru the program, T1CON 'timer1' is always set to the 'external counter' mode

    Which part of the meter operation 'appears' to be slow.?
     
    Last edited: May 28, 2008
  12. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi mrx23,

    Since you seem to have no name I shall call you Bob!

    Well Bob, the speed was an illusion caused probably by my excitement at the fact that I no longer had the hangup issue!

    I have tried both the 628 and 628A again and they seem to perform exactly the same (once past the hangup on the "A") and if Eric says the code will work then I wouldn't question it, to me his word is law ;)

    If you only have access to an "A" chip then I would not let that stop me building an excellent meter that as I said earlier will work fine if you turn on in the L mode and then switch to C.

    Hope this helps...........Al
     
  13. mrx23

    mrx23 New Member

    Joined:
    Sep 30, 2007
    Messages:
    18
    Likes:
    0
    Hi,

    Ok now I see that there is no time difference between the A and Not A.

    Eric could you tell what causes the hang-up in C mode at start up?
    I think it stucks in the TITLE3 loop, but why?

    If I start building something that must be perfect:)

    Thank you!
    Bob
     
  14. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi Bob,
    I'll have a look, as I have said, I have not built this meter, no requirement for it.
    When you say it hangs up, do you mean that it shows TITLE3 for a long time before you can change the switches.?

    Let you know.
     
  15. mrx23

    mrx23 New Member

    Joined:
    Sep 30, 2007
    Messages:
    18
    Likes:
    0
    Hi,

    I read in other forums that there is a typical "freezing" problem with A version. This was confirmed by Al:

    "Me: So you don't have the "CAPICATOR TIME OUT" hanging at startup?"
    "Al: Yes I have the hangup"

    I looked at the ASM, I only found this two similar messages:
    "WAITING TIMING" (TITLEB) and "TIME OUT" (TIMEDOUT)

    TITLEB is only called from TITLE3
    TIMEDOUT is only called from TIMOUT2

    I think that MCUs do not freeze (with proper PSU), but they do look like freezed in an endless loop.

    Thx for helping with the code.
     
  16. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi Eric,

    When Bob says the meter hangs if its the problem I had with the "A" then what happens is that when switched on with the C setting (probes open) then the meter shows "waiting timing" and then after a few seconds it changes to "timed out" and will not measure at all.

    As I said to Bob, if you turn on the meter in L mode (probes shorted) and let it set up, then change to C mode it will work fine, until Bob mentioned that this may be because of the "A" Pic I just thought no more of it as the workaround wasn't too much of a chore, but I must admit since I changed to the non "A" that I haven't missed the workaround one bit ;)

    The timeout lockup may be caused by something very subtle and may be difficult to find, but as I told Bob, I would still use my meter if I only had an "A" Pic and would still be very happy with it!

    Yours..............Al
     
  17. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi Al,
    Thanks for the clear description of the problem.

    I will look later today, I may have to 'knock up' a 'noddy' version of the meter to I can check in real time.!:)

    Glossary of terms:
    Knock up, means construct a rough working model.
    noddy, as simple and quick as possible....:p
     
  18. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi mrx,
    I have made a working circuit of the meter, no PIC connect at this time.
    Monitored the meter using a scope.

    Found that with the meter switched to CAP and the test leads open the 'cap osc' does not always start up.
    So no pulses go to RB6 Tmr1 input, hence the program will Time Out and freeze.

    This dosn't happen with 'ind cap' the ind osc always starts OK.

    Looking back thru other forums, this has been an inherent fault for user having the 16F628 version for a long time.!

    Checking thru the program I cannot see a link between the change to 628A from the 628 that would explain the bug.

    I will look some more, let you know.
     
  19. mrx23

    mrx23 New Member

    Joined:
    Sep 30, 2007
    Messages:
    18
    Likes:
    0
    Great research Eric!

    Maybe it's not a program bug.
    If the CAP osc circuit doesn't start up it might be a simple electronic problem.

    And what's the difference between start in CAP mode and switch to CAP mode (without Cx)?
    Maybe the CAP osc needs a little time to be stabilized? (a delay in the startup subroutine)
     
  20. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi mrx AKA Bob,
    What the unit does is to use the CAP osc frequency, based on the 1n0 and 10K,1K , during initialisation to determine the base frequency due to this 1n0 Cap and the stray cap from the test leads.
    It stores this 'base' frequency/count and uses it as a NULLING value for future CAP measurements.

    The problem seems to be, the CAP osc has two modes of osc when the meter is powered ON.
    In the unstable mode, the freq is so high, that it lacks the drive to switch the input to B6/Tmr1 of the PIC at TTL levels.
    The PIC just sits there waiting for the initial calibration count, which never comes and so it freezes/locks up.

    I am going look some more today.;)
     
    Last edited: May 31, 2008
    • Like Like x 1
  21. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    Hi Al,
    I have built the LCF meter, on the bench, used the last 16F628A program in a PIC.
    As I explained earlier the frequency of the CAP osc can be very high at switch ON.

    This high freq is connected from the 4011 pin10 to the PIC pin 12 via a 10k resistor.
    The high freq at the PIC pin after its passed thru the 10K is insufficient to switch the Tmr1 input,
    so the program waits forever.!

    Reduce the 10K0 [R5] to 4K7 [ put another 10K in parallel if its easier]

    This fixes the problem 100% on my test set up ...:)

    Can you give it a try, leave the test prods open as per the designers instructions.
    Let me know what you find..

    I know that the 10K is there to protect the 4011 output when an external freq is input,
    but the 4K7 should get the same result.
     
    Last edited: May 31, 2008

Share This Page