RB0 interrupt and toggle issue


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yesterday I tried my version and it seems to work properly here, the second addition above "should" cover what the OP need...

    Fact is, when you're using push button and interrupts, things can sometimes pan-out in weird way due to the noise on the contact when you push/release them.
    Code:
    keys2: ; Called by Interrupt update relay
    
            pause 20 ' small debounce delay
            if !PORTB.0 then GetOut ' button up?
                                    ' If so, getout of here... no need for noise call
    is one way to avoid problem, even thought, it's not always the best way
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2


    Did you find this post helpful? Yes | No

    Talking Awesome!

    mister-e you are right on the money! I added PayLoad = PORTD and it works very well, it toggles the individual bits only and not reset the entire port. PortA.4 is not responding though....it stays low.

    Thank you and everyone who helped. I think I will be using this new interrupt handler in the future.

    Nick
    Last edited by Macgman2000; - 5th May 2009 at 20:45.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    <table><tr><td></td><td>
    PortA.4 is not responding though....it stays low
    for PORTA.4... well... it's an open-collector output type on this one. So you may need to slightly modify your hardware and software.

    http://www.picbasic.co.uk/forum/showthread.php?t=11116

    In brief, connect your LED between Vdd and PORTA.4, and change those
    Code:
    PORTA = 0
    to
    Code:
    PORTA = %00010000
    That should work for LEDs. If you drive a transistor but then it's easier... not software modification are needed, just hardware.
    </td></tr></table>
    Last edited by mister_e; - 5th May 2009 at 21:10.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 23:14
  2. TMR0 interrupt and HSERIN
    By boban in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd September 2008, 12:48
  3. I have problem with interrupt RB0
    By chai98a in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th July 2008, 10:55
  4. tmr2 interrupt problem
    By ADCON in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 2nd January 2008, 19:49
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

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