PDA

View Full Version : Using PIC as a Low Voltage Meter, need help



doable
- 22nd June 2008, 22:57
Hello everybody, I have used pics before and I am still green, I managed to create inputs and outputs ok, used some time delays, but i now have a need to create a PIC managed voltage meter in the range of 0 to 2 volts., also must have four places. I have seen PIC controlled LCD and LED displays. Iam open on either. I do have the schematic for a PIC16F877A but no code! Can any body help with the code to get this project underway?

Thanks in advance, I have tryed other forums with little to no responce, I am starting to believe that its not a easy task.

Jerson
- 23rd June 2008, 02:06
Hi Doable

I'm not sure if anyone could help without knowing details of your board. Maybe you'd like to consider posting the schematic of your board to get ideas flowing.

doable
- 24th June 2008, 12:15
Thanks Jerson,

Heres the schematic of a PIC 16F876A with a LCD display showing 2 lines, able to output 2 voltages as i need.

This looks like what i need, i cant get any responce form the site that has posted this schematic!

Its a pleasure to get a responce to the question, thanks again Jerson.

Acetronics2
- 24th June 2008, 12:41
Hi, Doable

I think a look to the SAMPLES folder of your PbP CD will show you how to deal with the PIC A/D converter ... and display the result.

search for "ADCin xxxxx.bas"

The link you gave only allows ( with buying the '876 ) a 0 - 7v range ... by changing the input divider ratio.

These examples are for '877 and '876 ... surprise !

Alain

doable
- 25th June 2008, 00:38
Hello Alian,

I am using Microchip PICkit-2 and MPLAB, are the SAMPLES folders you speak of on those disk? If not wher can i get the sample folders of PbP CD?

Ioannis
- 25th June 2008, 07:15
Alain gave you the direction, to your legal obtained CD. Are a legal owner?

Ioannis

Acetronics2
- 25th June 2008, 10:12
Hi, Ioannis

As those files are free to download for every one ... and considering our friend's profile ...

let's give this link without any indiscreet further question ...

http://www.melabs.com/resources/samples.htm

Alain

Ioannis
- 25th June 2008, 10:26
Okie-dokie Alain...

Ioannis

doable
- 26th June 2008, 02:46
Thanks Alian for the information,

I dont want to sound stupid but i have little experance in the PIC world, but have a great thurst to learn. Now with the system i am using are the code examples compatable. I have done enough to have learned that even between different PIC the basic code changes, I dont understand Microchip's reason for that.

I will attemp to write to a PIC16F877A the sample code for the voltage meter, I am sure that i have more questions later on. Thanks again for helping with this!

skimask
- 26th June 2008, 03:58
let's give this link without any indiscreet further question ...
Probably never seen the 'little green book' either...

Acetronics2
- 26th June 2008, 08:22
Hi, Ski

As Mel said ... let's be helpful, ... !!!

Alain

falingtrea
- 26th June 2008, 19:55
One thing you can do is to take away the resistor network on your analog inputs and just put a 1k in place of the 100k(for isolation and input protection). That resistor network is scaling a 0-70v input to a 0-5v in to the PIC.

Then connect a 2 volt source to AN3 to serve as the high voltage ref. To do this you need to set register bits PCFG3-0 to '0001'. This changes the range of the ADC to 0-2V, instaed of 0-5v. You could use a simple resistor divider like 3k/2k or a precision voltage reference like a LMV431 or even a zener diode.

doable
- 27th June 2008, 17:41
Thanks Tim for the info, i will try that and let you know how it worked.