A Simple IOC Routine (Interrupt On Change)


Closed Thread
Results 1 to 7 of 7

Hybrid View

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


    Did you find this post helpful? Yes | No

    Wink Program of the year award !!!

    Hi, Luis

    But ... Where's your interrupt stubb gone ???

    you should turn INTCON.7 to OFF ... as an interrupt occuring sends you to PAUSE asm routine library ... @ Prog mem location 4 !!!


    here you do not use the interrupt system but just flag the Change in I/Os ... and further test the flag.

    it would really be a miracle if your program shows you what you were looking for ...

    Alain
    Last edited by Acetronics2; - 8th March 2010 at 17:14.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  2. #2
    Join Date
    Feb 2010
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Luis

    But ... Where's your interrupt stubb gone ???

    you should turn INTCON.7 to OFF ... as an interrupt occuring sends you to PAUSE asm routine library ... @ Prog mem location 4 !!!


    here you do not use the interrupt system but just flag the Change in I/Os ... and further test the flag.

    it would really be a miracle if your program shows you what you were looking for ...

    Alain
    The trick here is that i'm not using normal interrupt, all I do for this is, if a change occurs on RA0 turn on RC5 half second and then turn it off. the GIE turn off when a change on RA0 happen and GIE = 1 again when the missmatch ends.

    Only simulate and you'll see

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


    Did you find this post helpful? Yes | No

    Default

    Hi, Luis

    I 've already made much worse than that ...

    Darrel can confirm !!!

    But your code goes straight to the pBp libraries @ location 4 , if you enable GIE ... ( I verified it with MPSIM !!! )

    Program pointer passes over ALL the PAUSE library ... luckily it's the only routine here...

    DANGER !!!

    Alain
    Last edited by Acetronics2; - 8th March 2010 at 18:16.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  4. #4
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Sitting in a loop while waiting for something to happen (in this case, polling the RAIF flag) isn't really what interrupts are about.

    To be really useful, it should actually interrupt whatever your program is currently doing when RA0 changes state. For example, let's say you have a routine the is blinking PORTC.5 at a slow rate of 500mS ON and 500mS OFF continuously in a loop. If the state of RA0 changes (eg. by using a switch or sensor), then you want the blink rate to go faster rate, say 100ms ON and 100ms OFF.

  5. #5
    Join Date
    Feb 2010
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Acetronics, i dunno understand, i'm newbie and my english is not excellent, but since i'm going to use IOC for a button and external INT over RA2 for measure a pulse, when i get there, i think i'll see the problem.

    Meanwhile if i'm going to use INT over RA2 to measure pulse width, i do need to send first a dummy pulse before the pulse to measure?

Similar Threads

  1. 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
  2. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  3. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  4. Simple Interrupt Program
    By eoasap in forum General
    Replies: 5
    Last Post: - 28th October 2005, 16:22
  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 : 2

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts