Mizoro
Newbie level 4
- Joined
- Mar 25, 2012
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,344
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
thanx for reply, i already use ADC ,i start the sequence by activating that terminal as a digital high then low to let the cap charge ,in this moment i start the timer and wait for the voltage to reach some level ,but i don't know whether the delay i use is enough for the cap to charge or not and i don't know the proper voltage level to stop timer at either ,I've been trying so many times but i can't reach a stable reading and i can't utilize that reading since the onl equation i find is :RH = (time*10 - RHconst)/24 and that is the problemWell, you could use the ADC, no?
sorry but i did say in the first post that i need to read without using any comparator,i only use TIMER0 and ADC here is my code :You've got me confused. If you are using the ADC, why would you need the comparator? What do you mean by 'unstable readings? how are you reading the voltage?
Well, I STILL don't see why you are talking about a comparator if you're looking at this with the adc. I don't quite understand what you are doing, exactly; can you explain this a little better. It appears that you are charging and discharging the sensor(cap) through a 220 ohm resistor, is that right? This appears to be a little small, since it will only give you a nominal time constant of 33 nS. I THINK what you would want to do is start charging the cap through a resistor, and sample the voltage output. From your samples you should be able to determine the time constant, and, thus, the capacitance.
How are you "allowing it to discharge through the 10M"? First of all, you've got leakage current on the port that you are driving the cap with. Then, you've got a relatively HUGE input current for your ADC. If you look at the data sheet you'll see that:
1) Recommended source impedance for the ADC is 2K (not 10M)
2) The input current for the ADC is 150 uA
If you want to use the method you are proposing, I think you need a buffer.
And, in your original post you stated that you wanted to do this "without using any of pic comparators". I was questioning why you were even THINKING about using a comparator.