Interrupt mystery - need some guru help


Closed Thread
Results 1 to 40 of 44

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BobP View Post
    The important part of the datasheet is this bit,
    'For enabled interrupt-on-change pins, the values are
    compared with the old value latched on the last read of
    PORTA
    . The ‘mismatch’ outputs of the last read are
    OR’d together to set the PORTA Change Interrupt Flag
    bit (RAIF) in the INTCON register (Register 2-3).'
    Quote Originally Posted by xnihilo View Post
    i DO read porta bits individually prior to enabling intcon, even if i maybe didn't mention it.
    (from Sesame Street)...
    One of these sentences...is not like the other...

  2. #2
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by skimask View Post
    (from Sesame Street)...
    One of these sentences...is not like the other...
    let me explain.

    1- i use INTCON = %10001000
    it means i enable GIE bit, porta change int bit AND clear all interrupt flags. So i DO clear int flags.

    2- in my previous project (called int.pcb, wonder why...), i didn't read porta before enabling interrupts (to clear potential mismatch), BUT ra3 was not enabled for int in IOCA register so it didn't trigger interrupt if not tied to vdd with a wpu.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xnihilo View Post
    1- i use INTCON = %10001000
    it means i enable GIE bit, porta change int bit AND clear all interrupt flags. So i DO clear int flags.
    Yep...sure do...and that's all fine and dandy...

    2- in my previous project (called int.pcb, wonder why...), i didn't read porta before enabling interrupts (to clear potential mismatch), BUT ra3 was not enabled for int in IOCA register so it didn't trigger interrupt if not tied to vdd with a wpu.
    But!....3 posts ago...one of those sentences is STILL not like the others...
    And I had a look at your code...one small thing (I think) and you'll be set...

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


    Did you find this post helpful? Yes | No

    Default

    Come on ski.

    You're not being a "Teacher".
    You are purposely tormenting him. And enjoying it.

    It's a single line of code.
    Just tell him.
    <br>
    DT

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Come on ski.
    You're not being a "Teacher".
    You are purposely tormenting him. And enjoying it.
    It's a single line of code.
    Just tell him.
    <br>
    But I'm not a teacher, heck, as you all probably know, I'm not even a programmer!
    I am, however, a leader. Ask any of the guys that I trained to replace me, and they have...they'll tell you...(show me your war face! Arrrrrggghhhh!)
    And I'm not enjoying it. It's like having a noob (at my job anyways) and trying to explain the inner workings of a synchro system and how it fully applies to an autopilot system...and he just doesn't get it (ran into this exact situation last week). Felt like slapping the kid across the flightline. Took him 3 days, then he came in monday morning with the answers and it had all clicked over the weekend (of course I had assigned him weekend duty just to try and comprehend the whole thing)...

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


    Did you find this post helpful? Yes | No

    Default

    Remind me not to fly on one of your planes.

    When people get thrown extra duty because they didn't know something and the boss refused to help.
    It's likely they won't bother asking questions the next time they have problems.

    Who know's what goes un-fixed.

    Fine, I'll do it.

    xnihilo,
    Code:
    i VAR BYTE
    
    i = PORTA            ' Clear mismatch condition
    INTCON = %00001000   ' enable porta interrupts on change and clear flag
    
    ON INTERRUPT GOTO in_sig    ' int routine
    Remove the other INTCON statement.
    DT

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Remind me not to fly on one of your planes.
    When people get thrown extra duty because they didn't know something and the boss refused to help.
    It's likely they won't bother asking questions the next time they have problems.
    Who know's what goes un-fixed.
    WHOA! Don't get me wrong...I'm not that much of a jerk. They had it coming to them anyways...regardless if they would've had the answer or not.
    And I had given them ALL of the tools they needed to solve the issue at hand.
    And...don't forget...I'm a pilot myself. I know the responsibility that comes with having others living directly in your hands.
    Sounds like a 'Hair Club for Men' commercial...
    Not only am I a pilot, but I work on them too...

    At any rate...I hope that fixes the issue with the program. I was going to fix it in a more roundabout way, but your solution works better.
    Last edited by skimask; - 21st March 2008 at 23:03.

  8. #8
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Smile solving interrupt mysteries

    Quote Originally Posted by Darrel Taylor View Post
    Remind me not to fly on one of your planes.

    When people get thrown extra duty because they didn't know something and the boss refused to help.
    It's likely they won't bother asking questions the next time they have problems.

    Who know's what goes un-fixed.

    Fine, I'll do it.

    xnihilo,
    Code:
    i VAR BYTE
    
    i = PORTA            ' Clear mismatch condition
    INTCON = %00001000   ' enable porta interrupts on change and clear flag
    
    ON INTERRUPT GOTO in_sig    ' int routine
    Remove the other INTCON statement.
    Thank you very much, I'll report if it worked for me.

    Have a nice WE.

  9. #9
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Smile Progressing

    Quote Originally Posted by Darrel Taylor View Post
    Remind me not to fly on one of your planes.

    When people get thrown extra duty because they didn't know something and the boss refused to help.
    It's likely they won't bother asking questions the next time they have problems.

    Who know's what goes un-fixed.

    Fine, I'll do it.

    xnihilo,
    Code:
    i VAR BYTE
    
    i = PORTA            ' Clear mismatch condition
    INTCON = %00001000   ' enable porta interrupts on change and clear flag
    
    ON INTERRUPT GOTO in_sig    ' int routine
    Remove the other INTCON statement.
    It looks like I could finaly prevent interrupts occuring without no reason.
    I still have to thoroughly test the program.
    I would like to know what's the need for GIE.
    In your code above, you don't enable GIE at all, I followed your instructions and it worked.
    I thought that in order for Interrupts for PORTA change (or any interrupts) to be enabled, GIE bit had to be set. I could not find clear information neither in pbp manual nor in the pic datasheet.

    I have more strange things happening though, in my program just after the int routine label if I add an LCD output with the value of variable "a" bits (with a loop of 6 iterations and LCDOUT #a.0(i)) after an "a=porta" to get port pins values and clear mismatch), the value displayed doesn't change no matter what pin triggered the int (even if the right pin is detected), and ever more strange, after the interrupt routine is finished and before going back to the infinite loop, the value of portA bits is displayed once again, with no reason...
    Subtleties...

    Anyway, thanks a lot for your help, hope it solved the problem. It is still not crystal clear for me how to use stuff related to interrupts, I'm using the instructions more or less empiricaly and I'm not sure about the order in which I write the program sections.

    If you have some time to waste, maybe you could have a look at my program and let me know if you see very horrible things
    http://users.edpnet.be/charlesetchri...g/se230308.pbp

    Best regards

  10. #10
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Angry

    Quote Originally Posted by skimask View Post
    But I'm not a teacher, heck, as you all probably know, I'm not even a programmer!
    I am, however, a leader. Ask any of the guys that I trained to replace me, and they have...they'll tell you...(show me your war face! Arrrrrggghhhh!)
    And I'm not enjoying it. It's like having a noob (at my job anyways) and trying to explain the inner workings of a synchro system and how it fully applies to an autopilot system...and he just doesn't get it (ran into this exact situation last week). Felt like slapping the kid across the flightline. Took him 3 days, then he came in monday morning with the answers and it had all clicked over the weekend (of course I had assigned him weekend duty just to try and comprehend the whole thing)...
    Do you know the movies "SAW", I wonder why I think about it when I read your posts...

  11. #11
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xnihilo View Post
    Do you know the movies "SAW", I wonder why I think about it when I read your posts...
    'cause you like things like heating pads and shooting things I guess.
    And no, I haven't seen SAW. Should have seen SAW? I'll ask the wife if she saw SAW...while she's on the see-saw. Maybe she saw SAW. Maybe I should go see SAW. If I saw SAW, maybe I'd see what you saw when you saw SAW. I'll report back after I see SAW to tell you what I saw when I saw SAW.

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