Help Needed with Darrel's Interrupt on Change Routine


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    173


    Did you find this post helpful? Yes | No

    Default Re: Help Needed with Darrel's Interrupt on Change Routine

    So close and yet so far....

    Thanks for the input guys. I added the IOCBF=0 line to the ISR and, after adding a slight pause to debounce the switch, all is now working properly.

    Two things confuse me though:

    1/. Without the IOCBF=0 statement, why didn't my initial code get to the ISR the first time a switch was pressed? I would have expected the ISR to be called once (changing Level from 3 to 4 or 3 to 2 depending which switch was pushed) but then halting due to the IOCBF not being reset.

    2/. What should I expect regarding the commenting-out of the variables (wsave etc) when first compiling the Instant Interrupt routine? It compiles with all lines commented out. Is this right and if so, why?

    Cheers
    Barry
    VK2XBP

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Help Needed with Darrel's Interrupt on Change Routine

    1. It would have called the ISR the first time.
      But it would have never made it back to the main program to display the change.
      As soon as it exits the ISR, it immediately triggers an interrupt again because the flag wasn't cleared.
      .
    2. The 16F1's do automatic context saving.
      You do not need any wsave variables.

      Which is why it didn't tell you to uncomment any of them.
    DT

  3. #3
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    173


    Did you find this post helpful? Yes | No

    Default Re: Help Needed with Darrel's Interrupt on Change Routine

    Thanks Darrel.

    I understand now.

    Onwards and upwards! Time to add your Elapsed Timer routine to this project

    Cheers
    Barry
    VK2XBP

Similar Threads

  1. incPID Routine - Help Needed
    By Aussie Barry in forum mel PIC BASIC Pro
    Replies: 63
    Last Post: - 26th September 2013, 12:31
  2. Help needed with ADCIN Averaging Routine
    By Aussie Barry in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 24th December 2012, 16:05
  3. A Simple IOC Routine (Interrupt On Change)
    By lugo.p in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th March 2010, 19:53
  4. Darrel's latest 16 bit averaging routine?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 17th October 2009, 01:57
  5. Darrel's Averaging Routine
    By Andy Wood in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th June 2008, 23:24

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