Hi Michael,
1 thought comes to mind, have you measured the total leakage current going to ground while the CAP is charging? I am curious as to the Hi state voltage at the capacitor too.
Hi Michael,
1 thought comes to mind, have you measured the total leakage current going to ground while the CAP is charging? I am curious as to the Hi state voltage at the capacitor too.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
I'm working on some different code right now -- I HAVE to solve this in code or I'm screwed.
I haven't measured leakage currents or anything, it will do the same thin on a variety of caps-- I've tried 3 different electrolytics at 47 -- 1000 and 2200 --same results.
Besides, what is wierd is that if I take the cap out and it just sees the resistence of the trim pot to ground,,,,all is fine (about 2.2K).
For some reason, this cap must be shunting the output to ground -- but why "here and there".
Oh well, back to my code.
Might have to run the PIC faster. 4Mhz...cap is probably discharging before you even get a chance to see it.
I did a project awhile back where I used an LED as a touch sensor, basically read the residual voltage across an LED after 'charging' it. An LED has X amount of junction cap's, and it can be varied a bit by the amount of ambient light hitting the surface of the LED...
Anywho's, long story short, I tried it at 4Mhz, didn't work, no matter how tight I made the code. Capacitance was discharging faster than I could read it. Sped the PIC up to 40Mhz, worked like a champ.
EDIT: Disregard...I just noticed you were using a 16C65B... Wow! That's old school. There's a lot of newer options out there. Options that include built in comparators, ADC's, and so on...run faster, use less power, and so on...
If you are wanting to read the state of the cap charges, shouldn't you be making the ports inputs after they are triggered?
Thank God -- I just figured it out and I had suspected all along it was because HIGH portX
was being called more than once ? BUT, it never went low in the code so why would would that happen?
The port output wasn't appearing as true DC and the cap was taking it to ground?
Strange though because some channels would work fine.
Anyway - problem solved.
I did some code where once the input is trggered it called a subroutine that made the output HIGH just once.
Still, I wish I knew exactly why
start
If porta.0 = 0 then
high portd.0
endif
goto start
....acts wacko with the cap
Is the high output in that case looking like a rapid pulsating DC or something?
Funny thing is -- whenever I've gotten desperate enough to use this forum -- I always figure
it out 15 minutes after I post. !!
Anyone else like that?? LOL
Yeah JD123, that's part of this program -- I wait a few seconds and then make the pins inputs to see the charged cap.
16C65's because it's what I have (as in hundreds).
I guarantee though if anyone breadboards it and tries it you'll encounter the same thing.
Still would like to learn why I had that problem.
Because actually when you run code over and over again that includes HIGH it's pulsing the output pin again and again based on the instruction clocks square wave?
But when you call HIGH just once and leave the output pin alone, it's a steady DC that is stable.
start
If porta.0 = 0 then
high portd.0
endif
do other stuff
If porta.0 = 0 then
high portd.0
endif
do other stuff
If porta.0 = 0 then
high portd.0
endif
goto start
Not good when a capacitor is on the output?
Bookmarks