Interrupt Or I Am Going To Die


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    As Steve repeated,

    May be, a code like the one below could do the job for you, may be.

    Code:
    TRISA =  %00000000     'All output.
    TRISB =  %01000000     'RB6 is input, rest is output.
    
    IN_PIN VAR PORTB.6
    
                                                     
    Loop:
    
        WHILE IN_PIN
            PORTA = 255
            PAUSE 200
            PORTA = 0
            PAUSE 200
        WEND
        PORTA = 0
    
        GOTO Loop
    
    END
    Not a real drop-in interrupt compatible code but may work in some cases.

    Try...
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  2. #2
    kunguz's Avatar
    kunguz Guest


    Did you find this post helpful? Yes | No

    Question Finally working but still got a problem

    Thanks alot for your helps and replies;

    It finally works with this code below , but to return to main progress takes approximetly 1:20 minute. I think there might be problem with my schematic; If ISIS is that good, may be simulation thinks about small arcs that is created by button .Which gives a unexpected voltage levels for a short time to the PORTB.6.So PIC interrupts it's self for more then one time.The reason that took so long, might be that. Is this the problem or is it still in software _?

    device 16f84a
    ON_INTERRUPT goto flash
    intcon = %10001000
    input portb.6

    loop:
    high porta
    delayms 200
    low porta
    delayms 200
    goto loop

    disable

    flash:
    delayms 1000
    MOVF PORTB, W
    low porta
    intcon.0 = 0
    CONTEXT RESTORE

    end

  3. #3
    kunguz's Avatar
    kunguz Guest


    Did you find this post helpful? Yes | No

    Question Microchip

    After removing delayms1000 waiting for interrupt takes much shorter time like 1 sec. And I look with an osiloscope in simultion to the portb.6 which i see is a clear 5V. http://ww1.microchip.com/downloads/e...tes/00566b.pdf after reading this I get the feeling like this circuit did not fit for a small pulse width. Is this the problem or am I doing something wrong in programming

  4. #4
    kunguz's Avatar
    kunguz Guest


    Did you find this post helpful? Yes | No

    Question For a simple click I get 2 change

    After using this new code below, I get value of sayi +2 each time I click.

    device 16f84a
    ON_INTERRUPT goto flash
    intcon = %10001000
    input portb.6 ' Bu pinleri sıfırladıktan sonra alıcı olarak ayarlamalısın
    dim sayi as byte
    sayi = 0

    loop:
    high porta
    delayms 200
    serout portb.3,16780,[Dec sayi ,13]
    goto loop

    disable

    flash:
    MOVF PORTB, W
    low porta
    intcon.0 = 0
    sayi = sayi + 1
    CONTEXT RESTORE

    end

  5. #5
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Hi Kunguz,

    In your code, which you said works, how did you get "HIGH PORTA" or "LOW PORTA" work?


    ?


    -------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  6. #6
    kunguz's Avatar
    kunguz Guest


    Did you find this post helpful? Yes | No

    Thumbs up Just Works

    May be it's about my IDE ; I am using PROTON SE 1.1.2.8 ,And you can find the working circuit in the attachment with assembly and PICBASIC codes in it.
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    Certainely not an IDE problem There's few things in the world want to stay away of. Proton is one of these
    Last edited by mister_e; - 30th October 2006 at 03:35.
    Steve

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

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  3. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  4. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01: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