Continue to Site

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.

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

Help needed desperately with PIC LCF meter

Status
Not open for further replies.

bigal_scorpio

Active Member
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 :(

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

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

Attachments

  • LCFmet790.asm
    33.5 KB · Views: 1,020
  • LCFMET790.zip
    2.7 KB · Views: 1,121
Last edited:
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:
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
 
Hi Eric,

ericgibbs said:
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

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
 
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.?
 
Hi Eric,

ericgibbs said:
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.?

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
 
bigal_scorpio said:
The LCD just shows the 1st line of blocks, when contrast adjusted to suit.

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

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.
 
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:
3v0 said:
Maybe take a low tech path. You have an unused IO pin RA3. Add an LED with a 1K resistor to it and then write a simple program to make it blink. If that works you know you have a working uC.

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.
 
ericgibbs said:
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.

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.
 
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.:)
 
Further

ericgibbs said:
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.

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
 
ericgibbs said:
I expect you are using the free MPLAB V7.x IDE.???
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:
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...???
 
ericgibbs said:
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.
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.


ericgibbs said:
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...???
I haven't noticed that! Probably they've removed some OLD devices??
 
Last edited:
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:
Thanks again Eric

ericgibbs said:
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

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
 
bigal_scorpio said:
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.
Have you enabled the XP driver (Settings->Options->Misc)?
 
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
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top