Capacitor on PIC output


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1

    Default Capacitor on PIC output

    I have a simple problem that is making no sense at all.

    Using a 16C65B at 4mhz.

    Imagine if you will a simple RC circuit meant for timing that uses a 1000uf electrolytic cap to ground and a trim pot in parallel with the cap to ground for adjusting the delay.

    These rc circuits are on the output pins d.0 d.1 and d.2

    Using a pullup of 10k on the input pins e.0 e.1 and e.2


    The code is ultra simple --

    start

    If porte.2 = 0 then 'channel 1
    high portd.0
    endif

    if porte.1 = 0 then 'channel 2
    high portd.1
    endif

    if porte.0 = 0 then 'channel 3
    high portd.2
    endif

    goto start


    Now here's what happens --

    If I trigger each channel momentarily, one at a time, in any order, all is well -- the output pins each go high and stay there.

    If I latch on channel 1 with a constant jumper....
    channel 2 will operate fine but channel 3 will not go high if I try to trigger it.

    If I latch on channel 2...
    channel 3 will operate fine but channel 1 will not go high if I try to trigger it.

    If I latch on channel 3...
    neither channel 2 or channel 1 will operate.

    NOW --

    If I remove the cap from the channel trying to go high -- all is well.

    ??

    I've tried to fix this in code -- still working on it but I can't have the program stop (pause).

    I may end up figuring this out but sure would appreciate any hints.

    It has to be more than just the cap being there based on the examples I gave.

    THANKS KINDLY for any help.

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    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.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    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.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Michael View Post
    For some reason, this cap must be shunting the output to ground -- but why "here and there".
    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...

  5. #5
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    If you are wanting to read the state of the cap charges, shouldn't you be making the ports inputs after they are triggered?

  6. #6


    Did you find this post helpful? Yes | No

    Default

    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

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Michael View Post
    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
    Only everyone!

  8. #8
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Michael View Post
    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
    We are but the grease the gets the stuck wheels moving. And yes, but I don't have internet access where I code, so it's more like 1 day + 15 minutes.

  9. #9


    Did you find this post helpful? Yes | No

    Default

    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.

  10. #10
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Okay, Michael... I just didn't see that in your code.

Similar Threads

  1. Pic getting part power from Analog Port
    By ShaneMichael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 22nd April 2009, 10:34
  2. Can a pic do several things at once?
    By karenhornby in forum mel PIC BASIC Pro
    Replies: 31
    Last Post: - 10th May 2008, 00:09
  3. PIC 18f1220 EUSART Baud Rate Cache Problem
    By wklose99 in forum Off Topic
    Replies: 3
    Last Post: - 15th April 2008, 00:39
  4. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  5. PIC 2 PIC communication
    By Mario in forum Forum Requests
    Replies: 16
    Last Post: - 28th April 2006, 01:56

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts