How to know what pin triggered an interrupt?


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by skimask View Post
    My guess is that your original code a couple of posts above would be faster... There's a lot of bit shuffling that goes on with REV and NCD.
    Also, what happens if none of the pins are hit? If more than one pin is hit?
    You are right, bit shuffling and time wasting.
    Following your advice I sticked to my previous code (the one with the TIMER1) and amazing enough, it works (there was a debugging LCDOUT with a PAUSE 2000 adding a delay such that the next signal coming 100ms later would never be recorded anyway). Now the test led lights up very shortly (meaning the code is executed very fast) and when sending a burst of 4 signals from the remote other PIC, one every 100ms, the receiver circuit records all 4 signals (even with WRITEs adding some extra delays). I feel so releived... Thank god, it took so many hours/nights to get it right, I can go on with the other features.

    Thanks to all of you. Hope these posts might help others.
    I know that some questions I ask sometimes sound like: "I'm stuck, what is the answer?".
    I'm not asking for the solution but some ideas and some comments might guide me or show me an obvious mistake. I enjoy finding solutions myself but often, you guys help me a lot, either by a direct answer or by discussing about the stuff.
    I wish some day I will be able to help other.
    It's nice to have such places as this forum to brainstorm (I could not do that with Victoria, my almost 3 month old daugther who can anly say "agheu" and "pa"

    Still, I guess it would have worked with the PULSIN, I probably wasn't using it right but I didn't discover yet wat mistake I was making. As soon as I'm finished with higher priority coding I will get back to this chunk of code and see why the PULSIN version was taking about 1s to collect the 16 bits...


    "Also, what happens if none of the pins are hit? If more than one pin is hit?"

    -> If none are hits? How could it be, the code is in the int handler so there must be a pin that went from default HIGH to low because the TSOP sensor-demod received an IR signal and triggered the pic pin connected to it. There will always be one pin activated.
    What if more than one pin? Well, as I'm scanning the pins from pin 0 to pin 4 I will stop at the first pin that changed (as they are all default HIGH) and use that pin and deliberately ignore the other pins. As in real life, you can't be hit at the head AND at the leg with the same bullet, right? I check the most lethal area first, if the guy is hit in the head, who cares about a bullet hitting the arm...

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xnihilo View Post
    Hope these posts might help others.
    Well I learned about PORTA interrupts! That is going to be a big help.
    Dave
    Always wear safety glasses while programming.

  3. #3
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Well I learned about PORTA interrupts! That is going to be a big help.
    You bet! I could not live without port interrupts !

  4. #4


    Did you find this post helpful? Yes | No

    Default What a pleasure

    You know, Xnihilo - it's such a pleasure to see someone working themselves through a problem with the help of the guys on this Forum - and solving it
    But, that's what the forum it's all about, isnt it?

  5. #5
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Yes I just wish I can help other one day as much as I could be helped.

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. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07
  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