I needed this to measure water level. Tried the getrc command. It works with capacitor like 0.01uF. But does not work for water level (2 strips of aluminium foil attached on small plastic container).
And I could not understand it clearly to implement the elmchan code (complex for me) :cry:.
Bellow code works but does not remain stable:
[code:1:77425254f6]
Dim W As Word
Config Timer1 = Timer , Prescale = 1
Do
Pinb.5 = 0 '' Is it read only?
Ddrb.5 = 1 'discharge C
Waitms 300
Ddrb.5 = 0 'start charging
Timer1 = 0
Bitwait Pinb.5 , Set 'wait until pin inverted
W = Timer1
Print W
Loop
[/code:1:77425254f6]
The code is from:
http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=9658&highlight=capacitive+touch
I found a BasicStamp project where CD4060 IC is used, and using Bascom's Pulsein command good result is achieved. Now trying with this.
Best regards.
↧