Help with pic 12f629


Closed Thread
Results 1 to 40 of 53

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gutisie View Post
    The voltage for the circuitry is 5v....amperes very little, I think is not going to be a problem.
    You should ALWAYS assume EVERY mechanical contact switch bounces. The effects can be made less with tricks like DAVE suggests, and with higher quality snap type switches. But heres the thing: as 1 contact approaches the other, they WILL arc. The arc is the "bounce" this happens when opening and closing. Also, switches HATE DC. So if you want this to work for any lengh of time, be certain the switch is DC rated. DC causes the contacts to "plate" and then the bounceing gets worse until the switch quits all together.

    I am more concern with the switch being able to work at that speed...i dont know...i rather first understand the code, see what it should be, have something that i can built my proptotype on, and then see pros and cons.
    Otherwise this can be very long...

    Thanks for the help guys.
    Best regards.
    Not a bad approace at all. Good luck!
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    # 20 updated to our friend's desires ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Sep 2010
    Posts
    23


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by Acetronics View Post
    # 20 updated to our friend's desires ...

    Alain
    oooooomg!!!! you did it!!! it works!!!

    but i had to change it a bit.
    I will post the results later
    I am still shaking....

  4. #4
    Join Date
    Sep 2010
    Posts
    23


    Did you find this post helpful? Yes | No

    Wink

    hi, the code works fine under slow speed, it will count up to 3 and go off the led for 1 s, then on back again.

    Please see actual code.

    Code:
    DEFINE OSC 4
      
     
        cnt VAR BYTE
        delay var byte
     
        boton VAR GPIO.2
        mosfet VAR GPIO.1
     
     
     '   ANSEL           = 0     '12F675 for test
        CMCON           = 7
        OPTION_REG.7    = 0    'Pullups  enabled
        WPU             = %00000100
     
        cnt             = 0
        GPIO            = %00000110                 ' Nosurprise startup ...
        TRISIO          = %00000100 
     
    '******************************************************************************
    Detect: 'Button presses W/Debounce
    '
    delay = 0
    BUTTON Boton ,0,255,0,delay,1,pressed
                                      ' Slow Things down
        GOTO Detect
     
    '******************************************************************************    
    Pressed:  ' Some > 10ms press detected
        IF cnt <=1  Then 'tocount uptu 3, bigger values will add up.
     
            cnt = cnt + 1
     
        ELSE
     
            cnt = 0
            LOW mosfet
            PAUSE 1000
            high mosfet
     
        ENDIF
     
    WHILE !Boton : WEND                                ' Wait Boton release !!!    
    goto detect
     
    END
    I need much faster reading from the pic, other wise, it will count moreto go off, on breadboard, it may not even go on again.
    For some oscure reason, my Pbasic compiler, does not like the configuration line you put, after the OSCAL SETTING, in line one.
    So I have to set it manualy, using software configuration bit facility.

    See my circuit, but, instead of 2 only one led, on GP1, and Push boton on GP2.

    Best regards.



    Thanks Acetronics.
    Last edited by gutisie; - 26th September 2010 at 12:21.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi,

    oooooomg!!!! you did it!!! it works!!!
    Keep cool ... there's no miracle in that ...

    If you need faster response ... forget about your pushbutton !!! Button bouncings will give a totally random functionning ...
    another "detector" type has to be used.

    Now, modified code reacts for 2 pushings only ???

    The obscure reason is you use PM as an assembler and not MPASM with your Microcode IDE ...

    Alain
    Last edited by Acetronics2; - 26th September 2010 at 16:29.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Sep 2010
    Posts
    23


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by Acetronics View Post
    Hi,



    Keep cool ... there's no miracle in that ...

    If you need faster response ... forget about your pushbutton !!! Button bouncings will give a totally random functionning ...
    another "detector" type has to be used.

    Now, modified code reacts for 2 pushings only ???

    The obscure reason is you use PM as an assembler and not MPASM with your Microcode IDE ...

    Alain
    Hi thanks for your response, much appreciated.

    The compiler, i use is Pbasic?..with Mplab ide....these are at least the software names.
    Do you need a screen capture of the compiling results?

    And about the button...what type would you use?...I am absolutly clue less.....and desperate...and tyre...and bald....and...etc...

    Any way....Ir sensors?...proximity switches?....

    I once more depend on your wisdom master....

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Some testings show the minimum time for 3 pushes is ... around 78 ms !!! @ 10ms debounce time and a Pause 0 for scanning ...

    so, I really doubt any finger could do that !!!

    Quote Originally Posted by gutisie View Post
    And about the button...what type would you use?...I am absolutly clue less.....and desperate...and tyre...and bald....and...etc...

    Any way....Ir sensors?...proximity switches?....
    so What moves the button ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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