View previous topic :: View next topic |
Author |
Message |
ambivalent Guest
|
reading analogue voltage on A/D!!! |
Posted: Tue Nov 01, 2005 12:20 pm |
|
|
hi guyz, i hope everyone is doing fine.
i want to read analogue voltage on the A/D of pic16f877. the problem is that the voltage varies from -1 --> 6 volts. now i believe that this kind of voltage can not be applied directly to the PIC as 6volts may damage it.
i had the idea of adding 1 volt to the analogue voltage so that i have a range of 0 --> 7 volts, and then half this voltage before applying it to the analogue pin of the PIC, so i would have a range of 0 --> 3.5 volts. and then i would compensate for these manipulations in the converted digital value. Now this solution seems kind of complicated for such a simple issue. can any one please suggest another simpler way of reading an analogue voltage ranging from -1 --> 6 volts.
best regards |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Tue Nov 01, 2005 12:59 pm |
|
|
I'm not sure but think a combination voltage divider will do it if the source can drive the resisters in this circuit. Assuming your running on 5 volts.
Code: | 5V
|
R2
|
|
Source --- R1 ---+--- PIC in
|
|
R3
|
GND
R1=R2*5
R2=R3 |
|
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Tue Nov 01, 2005 5:39 pm |
|
|
Deleted - I goofed. I did not see the input was from -1 volt and the divider impedance was too high for the A/D as pointed out by PCM Programmer. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Last edited by asmallri on Tue Nov 01, 2005 6:43 pm; edited 2 times in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Nov 01, 2005 6:01 pm |
|
|
The impedance of the voltage divider circuit which feeds the PIC's
A/D pin must be kept under 10K, per the 16F877 data sheet.
What if he uses a voltage divider which divides the input range by 2
and then biases the bottom resistor at 1.0v so the output is 0 to 3.5v.
Code: |
Vin 4.7K
-1.0v >----/\/\/\/----------> To PIC A/D pin
to |
+6.0v >
< 4.7K
>
|
+1.0v |
------------
I just realized that my proposed solution is the Thevenin equivalent
to Neutone's circuit. Just a rough check gives approximate values
for his circuit of:
R1 = 4.7K
R2 = 27K
R3 = 6K |
|
|
|