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. bigal_scorpio

    bigal_scorpio Active Member

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

    I have built the PIC based Inductance / Capacitance / Frequency meter from the circuit below.

    My circuit is not totally dead, as in when I switch on I get the character squares on the LCD but no text of any kind and not the message that is supposed to display.

    The PIC the author used was a 16F628 and the only one I have is a 16F628A.

    I posted a question about differences on the forum and got replies saying that though the pins were exact that it was a silicon upgrade and that though the functions were all similar that the architecture of the "A" may be different.

    After looking at the migration documents I am baffled totally, but tried to follow the advice that I should use the "A" include file, but unfortunately I don't seem to be able to use the ASM file that the author provides to compile anything without getting many many errors!

    Can anyone tell me where I'm going wrong? Is the "A" different in a way that would require the "A" include for sure? Can anyone tell me why I'm getting errors when compiling the ASM file or is there a way of telling what compiler to use on a particular file?

    I am well out of my depth here so any info would be a great help.

    I am attaching the ASM file, code zip and link to the original site, so if you can help in any way, don't be shy, I will be only too glad to get some input on this problem that has me at the end of my tether.

    By the way if the only way of doing this is for me to get an actual 628 then I will but it means that I will be waiting probably another week for delivery :(

    http://www.electro-tech-online.com/custompdfs/2008/05/LCF.pdf

    Thanks for looking........Al
     

    Attached Files:

    Last edited: May 2, 2008
  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi desperate of Rotherham.:p

    Edited your listing to suit the MPLAB assembler for 16F628A.
    I expect you are using the free MPLAB V7.x IDE.???

    Runs OK on Oshonsoft SIM, see pixs.

    Lets know how it goes.

    EDIT: I have made NO program changes, just corrected for the MPLAB asm and 16F628A
     
    Last edited: Jul 7, 2008
  3. bigal_scorpio

    bigal_scorpio Active Member

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

    Hi Eric,

    Once again you come to the rescue! Thats Brilliant mate.

    Now I can have a go at the project again, and then the project that I started first and discovered I needed to measure an inductance to finish it! DOH! hehehe.

    But seriously many thanks again Eric.............Al :D
     
  4. dave

    Dave New Member

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


     
  5. bigal_scorpio

    bigal_scorpio Active Member

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

    Hi Eric,

    Sadly still no joy, and I have now changed every component and rechecked the PCB dozens of times. :(

    Do you still have the sim set up? If you do then would it be possible to check some parts of the board for me (maybe the PIC pins for instance) with the meter and tell me what I should be getting with the meter (still no scope yet sadly) this would be a great help and may mean I find the fault.

    BTW the code was spot on after you amended it and compiled with no errors, so I have now tried the PIC with both possible variants and at least hopefully ruled it out!

    Thanks again...........Al
     
  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi Al.
    Will do the pins, give me a little while.

    Exactly what do you get on the LCD.?

    What crystal freq are you using.

    Has the programmer you have made been proven on another project.?

    Are voltage rails showing the correct voltages.?
     
  7. bigal_scorpio

    bigal_scorpio Active Member

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

    The LCD just shows the 1st line of blocks, when contrast adjusted to suit.

    The crystal is 3.2768MhZ

    Yes the programmer has worked on 2 projects to date ( out of 2)

    The pos and neg rails are showing 4.98v and 0v respectively

    Hope this helps..............Al
     
  8. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    That's a sign that the display isn't being initialised - could be that the PIC isn't even running at all, or a programming, timing or hardware error.
     
  9. 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 agree with Nigel the LCD's not being setup.
    Lets go back to basics, I'll write a simple LCD setup/test program that will suit your wiring on that pcb.
    Unless you already have a LCD test program thats been proven.?

    In that way way we can check out the wiring etc.
     
  10. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    I feel a bit like I am budding in here given all the work Eric has done.

    You have not said much about the programmer. Does it claim to have verified the program without errors ?

    Given that Eric has simulated the circuit and that you have gone over the actual circuit I think there is a good chance the osc is not osc-ing.

    The squares on the LCD do not tell you the uC is working. I take it you do not have a scope, PICkit2/Junebug, or logic probe. With any of these you could verify that the PIC was running.

    Maybe take a low tech path. You have an unused IO pin RA3. Write a simple program to toggle it slowly. Check it with a voltmeter. If that works you know you have a working uC.
     
    Last edited: May 3, 2008
  11. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    This a way I was also going to suggest, are you able to write a blinking LED program Al,?
    A 220R and Red LED on RA3 should prove the PIC's working.
     
  12. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    I editing the post after you read it which may lead to confusion. I suggest skipping the LED and making the toggle slow enough to see with a volt meter.

    The author had the extra pin. He could have added the LED and resistor to the circuit as a debug aid. It may be low tech but if I have the pin to spare I often do it.
     
  13. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi 3v0,
    Yes, I use the same technique using a spare pin, it can save you lots of grief.

    Al has not got a scope, I expect he has a DVM to check the pin level.

    AL:
    If you do it this way, with a meter, ensure you have a delay between pin toggles so that you can see it change on the DVM.:)
     
  14. bigal_scorpio

    bigal_scorpio Active Member

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

    Hello again,

    I could possibly write a small prog but I wouldn't be certain of it, as I am not yet as PIC minded as you all are, but Erics offer of an LCD test programme to run in the hardware seems good to me and would certainly rule things out or in.

    BTW I have tried 3 different LCD modules so I assume you must be right with the PIC not initialising the screen.

    Also to the question of Verification, yes it does write and verify OK, and the config word is what it should be. Its a velleman kit programmer I have built, 4408 if I remember correctly.

    Thanks for all the input guys, and thanks Eric for the offer of the program, I await with my fingers crossed................Al
     
  15. eng1

    eng1 New Member

    Joined:
    Apr 7, 2006
    Messages:
    951
    Likes:
    19
    Location:
    Italy
    Hi Eric, it's time to update :) I'm running MPLAB v8.02 but I've noticed that v8.10 has been recently released.
    Now MPLAB can do automatic updates (MPLAB IDE checks the Microchip web site to see if a newer version is available and notifies the user).

    For PIC18 users, there is another nice feature I'd like to check soon:

    Default Linker Script for PIC18
    – Eliminates linker script confusion by automatically using a default linker script. No longer does the engineer need to switch linker scripts when using an in-circuit emulator or debugger. Additionally, the linker wizard doesn’t ask to select a linker script, which reduces the complexity of making projects. Additionally, the PIC18 family has a generic setting for building libraries that will work with any PIC18-family device.


    EDIT: sorry if I'm a little off-topic, but I hope that this info is useful for you all :)
     
    Last edited: May 3, 2008
  16. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi eng1,
    I did download and install V8 but for some reason the PC starting playing up, screen blanking during the assembly process. Never found out why.
    Not a problem with the code but damned irritating.
    So I removed it and reinstalled V7.

    Also IIRC I did hear claims that some of the earlier PICs had been dropped from the INC's.. thats open for confirmation or not...???
     
  17. eng1

    eng1 New Member

    Joined:
    Apr 7, 2006
    Messages:
    951
    Likes:
    19
    Location:
    Italy
    We could check if there are known bugs in the release notes...
    Also I noticed that I had multiple MPLAB intallations on my PC. I have recently removed the old versions and made a new complete installation.


    I haven't noticed that! Probably they've removed some OLD devices??
     
    Last edited: May 3, 2008
  18. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi Al,
    Attached LED test program for 628A.
    Displays "0123456789"

    There a few commented lines.

    Lets know.:)

    EDIT: add errorlevel inhibit for assembler warning messages
     
    Last edited: Jul 7, 2008
  19. bigal_scorpio

    bigal_scorpio Active Member

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

    Thats Brilliant Eric,

    Yeah thanks very much mate, as soon as I have solved the last problem I suddenly acquired I will try it (see my post "OOOPs") and let you know mate.

    I have been trying my fallback programmer (JDM type) but sadly now, just to add to the confusion, IC-Prog has decided that it will not run on my system without strange errors "Privileged instruction" that it has never done before!

    Just checking for viri now before I continue.

    I will keep you updated..........Thanks again.........Al
     
  20. eng1

    eng1 New Member

    Joined:
    Apr 7, 2006
    Messages:
    951
    Likes:
    19
    Location:
    Italy
    Have you enabled the XP driver (Settings->Options->Misc)?
     
  21. bigal_scorpio

    bigal_scorpio Active Member

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

    Thanks eng1, I didn't notice that seeting, but sadly it hasn't helped after I set it.

    Just cant seem to read / erase / program at all onto the 628A, it seems to run as soon as it goes into the programmer I think, can't stop it.

    I even made a small ICSP board with a NC switch so as to be able to insert the 628A before allowing the 5v to it, I read in an above thread that this may help, but yet again no luck, I guess the 628A is just stubborn, or a staunch Union IC, 1 IC 1 job eh! hehehe

    I will keep trying anyway, and at present am thinking of building another programmer with more control! Anyone got any suggestions of a good one?

    Regards...............Al
     

Share This Page