Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me with voltmeter code for PIC16f876

Status
Not open for further replies.
Re: pic16f876 voltmeter

Thanks for that I can't understand what's going on, My end seems fine

Sorry to be a pain could you give this one a try for me

I 've redone it so it should be better, if not them I'm stuck and shall have to look deeper into it
rajudp can you share source code so I can try and see where I may be going wrong

Thanks
Wizpic
 

Re: pic16f876 voltmeter

wizpic said:
Thanks for that I can't understand what's going on, My end seems fine

Sorry to be a pain could you give this one a try for me

I 've redone it so it should be better, if not them I'm stuck and shall have to look deeper into it
rajudp can you share source code so I can try and see where I may be going wrong

Thanks
Wizpic


OK, in a few minutes !
I have asked rajudp to share too !

Added after 10 minutes:

wizpic, here is your last hex (new voltmeter1):
https://www.youtube.com/watch?v=etSUrDqR5Yc
If you find out the problem , could you please share your code ?
Thanks !

Added after 8 minutes:

wizpic , rajudp, what software do you use for compiling ?
I'm using PIC C Compiler (PCWHD Compiler 4.093)
 

pic16f876 voltmeter

i am using 4.093
 

Re: pic16f876 voltmeter

To measure a negative voltage I need to change the hardware input (introducing an Operational Amplifier) or could be done from software ?
My connections:
C1 = GND
C2 = pic amps input
C4 = pic volts input

Therefore volts dysplay is not real because of the resistor
If I change C1 -> C2 and C2 -> C1, volts dysplay is OK but the amps is negative so nothing on the dysplay !
 

Re: pic16f876 voltmeter

For boosting the voltage accross the 0.1R resistor I use the circuit below. You use the 50K pot to calibrate the readings so that the reading match's your meter that is reading current. The best thing woould be to build it up using LM358 op-amp then beofre you connect it to the pic carry out a dummy test draw your current then meassure the voltage and see what the max ouput is it should be no more than 5V due it been run on 5V. Then hook it up, You may need to adjust your code to siut.


wizpic
 

pic16f876 voltmeter

hi wizpic ,
why 10uf capacitor at input, i think it will slow down the updates

Added after 5 minutes:

and i don't think the output will go beyond 5v bacause the opamp power supply is only 5v
 

pic16f876 voltmeter

That's the way the Schematic was, I menat to change it to a 100n, It was out of a battery charger circuit
 

pic16f876 voltmeter

hi birlan,
what about the results, working fine?
 

Re: pic16f876 voltmeter

hi rajudp,

I don't have time to build opamp scheme to test it (maybe at the end of the week)
Otherwise is working fine !
 

Re: pic16f876 voltmeter

birlan97
I think I found the problem why my readings are all over the show.
The I compiled runs at 4MHZ and looking at your code at the beginig and if I understand it right your running at 20MHZ ?
 

Re: pic16f876 voltmeter

Right !
First part of the code was taken from an old one and forgot to change
On the pcb I have 4Mhz Quartz !
 

pic16f876 voltmeter

rajudp what does your hex hile run at (the one you uploaded for us) ?

birlan97 dam I thought I cracked it then, Becasue it runs fine my end and does not do what it does on your videos
 

Re: pic16f876 voltmeter

wizpic: what is happened ? what did you do to crack_ it ? what do you mean by crack_ (hardware crack_ - it is burned) or software problem ?
Your scheme is different from mine ?
So: your hex working fine with your pcb and don't work fine with my pcb (this is the problem ?)
 

Re: pic16f876 voltmeter

birlan97 its a phrase we use when we say cracked it it means problem solved.

Which schematic are you talking about ?

Yes the hex is working fine my end, I run it on a esaypic board, I would not say it is your PCB at all, There is something not quite right either it be my end or you end , I would say more than lightly my end measn that rajudp's code work fine
 

Re: pic16f876 voltmeter

wizpic said:
rajudp what does your hex hile run at (the one you uploaded for us) ?

birlan97 dam I thought I cracked it then, Because it runs fine my end and does not do what it does on your videos

you mean the hardware?, no i am not tested it with any hardware from my side, just edited the file from the start of this post to do the needs. but i faced this type of problem when i designed my ac volt meter, first i did not understand what was happening, so i simulated it with Proteus then i found the volt at adc pin is changing by time to time ( half wave rectification and low value capacitor), finally i came with this solution. Hope it is working fine with you

Added after 12 minutes:

wizpic said:
Yes the hex is working fine my end, I run it on a esaypic board, I would not say it is your PCB at all, There is something not quite right either it be my end or you end , I would say more than lightly my end measn that rajudp's code work fine

have you checked it with pulsing or smps input, with dc input one time reading will work fine, for smps type you have at-least cover the entire width of the waveform for a steady reading( this is my thinking if anybody have better thoughts please share it )

Added after 4 minutes:

birlan97 said:
Right !
First part of the code was taken from an old one and forgot to change
On the pcb I have 4Mhz Quartz !

i compiled it for 20mhz ( #use delay(clock=20000000) and #fuses HS,NOWDT,NOPROTECT,NOLVP) from your code, if you compiled it for 4 Mhz Quartz then the display update rate will be less
 

Re: pic16f876 voltmeter

i compiled it for 20mhz ( #use delay(clock=20000000) and #fuses HS,NOWDT,NOPROTECT,NOLVP) from your code, if you compiled it for 4 Mhz Quartz then the display update rate will be less

This what I thought, My code was compiled to run at 4MHZ and thought that birlan97 was unsing a 20MHZ crystal, this would casue the readngs to bounce, So if birlan97
ran your code that was compiled to run at 20MHz and he used a 4MHZ crystal this would explain why the readings are sable,

birlan97 did you recompile at 4MHz and tried that ?

wizpic
 

Re: pic16f876 voltmeter

wizpic said:
i compiled it for 20mhz ( #use delay(clock=20000000) and #fuses HS,NOWDT,NOPROTECT,NOLVP) from your code, if you compiled it for 4 Mhz Quartz then the display update rate will be less

This what I thought, My code was compiled to run at 4MHZ and thought that birlan97 was unsing a 20MHZ crystal, this would casue the readngs to bounce, So if birlan97
ran your code that was compiled to run at 20MHz and he used a 4MHZ crystal this would explain why the readings are sable,

birlan97 did you recompile at 4MHz and tried that ?

wizpic

Not yet !
 

Re: pic16f876 voltmeter

hello Can you help me ? I need sheme (pic16 or pic18 ) for measuring impuls voltage !
(0.1mv-100mV,1-100Hz)
I'm looking for desing for Proteus! I have to do simulation with signal generator
I will measure amplitude on the square impulse!
 

Re: pic16f876 voltmeter

pl proed me volt meter based on pic 16f676 and 3pc.- 7 segment also.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top