Interrupt?? problem


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Scorp,

    Place disable before your interrupt sub-routine label, and place resume before
    enable at the end. Resume inserts retfie. Enable tells PBP to start inserting
    code to continue testing for the interrupt condition again. If you reverse the
    two, you're jumping out of the interrupt service routine to test for the
    interrupt condition you're already servicing.

    If you're using ADCIN, you don't need to mess with ADCON0. PBP handles this
    one for you automatically. TRIS, ADCON1, (ANSEL where applicable) must
    already be setup before using ADCIN, so make sure you set whatever A/D
    input pin you're using up as an input first.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    scorpion's Avatar
    scorpion Guest


    Did you find this post helpful? Yes | No

    Default say what now?

    I will try it first thing tomorow, but one question: If I move the disable and enable how will it ever get run? wouldnt it just skip right past those??? maybe im not sure exactly what you mean:

    disable 'disable interrupts
    ticker:
    intcon.2 = 0 'clear flag
    TMR0 = 129 'Set Preload
    tick = tick + 1 'keeps track of times it was interrupted
    if tick = onsteps then low pwmout 'if its where it needs to be to be switched, switch it
    if tick = 100 then 'if its at the end
    if current > offmax then high pwmout'and its above hysterisys then turn reset the PWM
    tick = 0 'and restart the ticker
    endif
    resume 'Restart the main program from where it left off
    enable 'enable interrupts

    I really cant see how this would work. i am assuming that i misunderstood.....

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Disable tells PBP to STOP auto-insertion of interrupt checking code. Placing
    disable "before" the interrupt service label doesn't actually disable interrupts.
    It just tells PBP to stop automatically placing interrupt checking code between
    each BASIC command. Your interrupt will work either way.

    ON INTERRUPT GOTO ? tells PBP where the interrupt service routine is located.

    Resume inserts RETFIE right at the end of your interrupt handler "code", and
    that's where you want RETFIE to be.

    Enable tells PBP to start auto-inserting interrupt testing code after each
    BASIC instruction, and you want this at the very end or after RESUME. Just
    like the ON INTERRUPT example shown in the manual.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    scorpion's Avatar
    scorpion Guest


    Did you find this post helpful? Yes | No

    Talking

    gotcha.
    thanks for the help!
    -scorp

Similar Threads

  1. problem using GOSUB under interrupt
    By fobya71 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 5th March 2010, 19:52
  2. Problem with Interrupt on PIC18F4620 PORTB
    By rookie in forum Off Topic
    Replies: 1
    Last Post: - 22nd March 2007, 01:34
  3. Interrupt Problem
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th November 2005, 20:58
  4. Interrupt stack overflow problem with Resume {label}
    By Yuantu Huang in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd May 2005, 01:17
  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