+ Post New Thread
Results 1 to 9 of 9
  1. #1
    Newbie level 4
    Points: 1,409, Level: 8
    Achievements:
    7 years registered

    Join Date
    Sep 2006
    Location
    Belgrade, Serbia
    Posts
    5
    Helped
    0 / 0
    Points
    1,409
    Level
    8

    Debounce problem or something else?

    I have problem with my project. The schematic is presented in attachment.
    This electronic circuit is for 5-digit seven segment displays (made from LED).
    Selecting the digit that should be changed is made by pressing SET push button
    and the digit that is selected start blinking. Then using UP&DOWN push buttons
    set up right number on selected digit and again press SET to move to another digit,
    when all 5 digits are set 6 press of SET button set selected number on display.
    Since I've didn't (as you can see on schematic) put any debounce filter on RB0-RB2
    PUSH BUTTON pins I've used software debounce routine in mikroBasic, waiting 20mS.

    Code:
    if (Button (PORTB,1,20,0)) then
                 Inc (digit)
                     while (RB1_bit <> 1)
                        if (digit > 11) then
                        digit=0
                        end if
                        cifre_array[n-1] = digit
                     wend
                 end if
    Now my problem is I have to use 5m cable to connect push buttons
    to this PCB and when everything is powered up it start working OK
    but after few days when I press SET button it runs over two, three
    digits like in debouncing and when I want to set number with UP or DOWN
    button it's almost impossible to get (stop on) the right number.
    Does any one have idea what can I do to solve this problem.

    Thanks in advance.

  2. #2
    Advanced Member level 5
    Points: 24,263, Level: 37
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,654
    Helped
    1031 / 1031
    Points
    24,263
    Level
    37

    Re: Debounce problem or something else?

    I don't know mikrobasic, but is that "Button" routine supposed to do the debouncing? If the thing works with a short cable, but not a 5m one, then you are probably picking up noise in the cable. Do you have internal pullups enabled on the PIC inputs? (I don't think it would work otherwise). Another thing to consider is the capacitance of the cable, maybe that's messing up things.

    But I would mostly suspect your debouncing/button reading routine. And it's a little puzzling that it 'works for a few days' and then fails. If you power cycle it does it start working properly again? Is something getting overheated?



    •   AltAdvertisement

        
       

  3. #3
    Newbie level 4
    Points: 1,409, Level: 8
    Achievements:
    7 years registered

    Join Date
    Sep 2006
    Location
    Belgrade, Serbia
    Posts
    5
    Helped
    0 / 0
    Points
    1,409
    Level
    8

    Re: Debounce problem or something else?

    Code:
    sub function Button(dim byref port as byte, dim pin, time,
    active_state as byte) as byte
    Returns 0 or 255.

    Function eliminates the influence of contact flickering upon pressing a button
    (debouncing).
    Parameter port specifies the location of the button; parameter pin is the pin
    number on designated port and goes from 0..7; parameter time is a debounce
    period in milliseconds; parameter active_state can be either 0 or 1, and it
    determines if the button is active upon logical zero or logical one.

    Yes I have internal pullups enabled on input pins.
    The cable is STP cat 6.
    Yes the biggest question is why everything works for few days and then start problems?
    As for overheating I have problems with resisotors on base of BC327 they are overheating.
    First I've used 470ohm 1/4W and then replace them with 910ohm 0.6W and they are also
    overheating, less then 470ohm but they get hot. Any suggestion about that?
    V+ is 12V.



  4. #4
    Advanced Member level 5
    Points: 24,263, Level: 37
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,654
    Helped
    1031 / 1031
    Points
    24,263
    Level
    37

    Re: Debounce problem or something else?

    After closer inspection, you've got a circuit problem. You've got 12 volts pulling up the bases of your transistors through RN2, and your pic is running off 5volts. You can't do that, you'll probably damage the pic output ports. My guess is that your poor PIC is getting toasted.



    •   AltAdvertisement

        
       

  5. #5
    Newbie level 4
    Points: 1,409, Level: 8
    Achievements:
    7 years registered

    Join Date
    Sep 2006
    Location
    Belgrade, Serbia
    Posts
    5
    Helped
    0 / 0
    Points
    1,409
    Level
    8

    Re: Debounce problem or something else?

    No,no transistors base are connected to output of IC5 and it's uln2803 (sorry for bad labeling of circuits on the schematic).
    ULN2803 sink the current from base of transistors so I think that is OK, unless...



  6. #6
    Advanced Member level 5
    Points: 24,263, Level: 37
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,654
    Helped
    1031 / 1031
    Points
    24,263
    Level
    37

    Re: Debounce problem or something else?

    Ah, ok. I missed that. As far as your resistors getting hot, a 470 ohm will be dissipating about 0.3W, so I'd expect it to get pretty hot. But that's a fairly hefty base current-about 25mA; I don't think you need that much. If your circuit is sitting in an enclosure, it might be getting overheated just from those resistors.



  7. #7
    Newbie level 4
    Points: 1,409, Level: 8
    Achievements:
    7 years registered

    Join Date
    Sep 2006
    Location
    Belgrade, Serbia
    Posts
    5
    Helped
    0 / 0
    Points
    1,409
    Level
    8

    Re: Debounce problem or something else?

    Yes 470ohm were to hot(I'we calculated them wrong) but then I replace them with 910ohm 0.6W
    and I still have problem with heating of the resistors, less than with 470 but still to much.
    And the circuit is in enclosure so you think that overheating can cause that kind of problems?



  8. #8
    Advanced Member level 5
    Points: 24,263, Level: 37
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,654
    Helped
    1031 / 1031
    Points
    24,263
    Level
    37

    Re: Debounce problem or something else?

    With 910 ohms you'll dissipate 0.15 W in each of the 8 base resistors-that's over 1 Watt total. Add to that the power dissipated in the RN2 pullups (value?) and you've got quite a bit of heat. I can't tell you how much the temperature is going to rise, but the fact that things work for a while and then stop can definitely be an indication of an overheating problem.



    •   AltAdvertisement

        
       

  9. #9
    Newbie level 4
    Points: 1,409, Level: 8
    Achievements:
    7 years registered

    Join Date
    Sep 2006
    Location
    Belgrade, Serbia
    Posts
    5
    Helped
    0 / 0
    Points
    1,409
    Level
    8

    Re: Debounce problem or something else?

    I will try to check if the overheating is problem. I'll put one circuit in enclosure and one not and try them to see what will happen.
    If the problem occurs with one in the enclosure I'll change their places and try again to see what we happen.

    Anyway thanks for help.



--[[ ]]--