Interrupt mystery - need some guru help


Closed Thread
Results 1 to 40 of 44

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Wink Interrupt mystery -

    Re-Read the replys the Clue to solve your mystery is "I.O.C."...
    hopes this helps just a little

  2. #2
    Join Date
    Mar 2004
    Location
    UK-Midlands
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Hi xnihilo,

    Don't get upset! We are only trying to help.

    A lot of posts the user just wants the answer without learning the ways of Microchip and the PIC's. They learn how to solve that problem but not how to understand the datasheet.
    Don't get me wrong, I have spent hours pulling out my hair and after posting the problem it turns out to be a simple mistake that I have made. We are all human.

    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).'

    The following tip is the last I can give. The next step is to write the program for you!

    Read the port before enabling the interupt!!!

    Regards,
    Bob

  3. #3
    Join Date
    Dec 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Post Interrupt mystery -

    A little more help. remember if any pins change state the RAIF is set in the INTCON register, you must end any mismatch on the port first then reset the RAIF bit. Can't be much more clear than this

    Mike

  4. #4
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BobP View Post
    Hi xnihilo,

    Don't get upset! We are only trying to help.

    A lot of posts the user just wants the answer without learning the ways of Microchip and the PIC's. They learn how to solve that problem but not how to understand the datasheet.
    Don't get me wrong, I have spent hours pulling out my hair and after posting the problem it turns out to be a simple mistake that I have made. We are all human.

    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).'

    The following tip is the last I can give. The next step is to write the program for you!

    Read the port before enabling the interupt!!!

    Regards,
    Bob
    Come on! I know i sound stupid but i am not.
    i DO read porta bits individually prior to enabling intcon, even if i maybe didn't mention it.
    the int occurs anyway. when i outout the state of porta at the begining of interrupt routine 2 strange things can be noticed. it seems it is ra3 that triggers the interrupt. however i used the same program structure for another project and i didn'have such problem. even if the ra3 was left floating.
    second thing: porta.5 value is not what it is supposed to be. with no wpu and set low with trisa, it is high when interrupt occurs. dammit.

    the complete source code is at:
    http://users.edpnet.be/charlesetchri...g/se210308.pbp

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


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I do hate war games ... ( except the film ...) BUT

    Code:
    FOR i = 0 to 5
        aport[i] = porta.0(i)       'mirror the pins states into the array
    NEXT i
    Are you really sure of those lines ... ???



    Alain

    PS
    Code:
        IF dead == 1 THEN finish    'if player is already dead, don't answer and leave the int routine
    Ha,ha,ha ... YOU 're dead !!!

    Re-PS

    Code:
    The PICs control transistors that drive relays for 9V supply to nichrome wires for the physical feedback. 
    One cm of 38ga Nichrome wire, with 9V and a 6 ohms resistor is heated for 500ms, inducing a little burn that will leave a very tiny scar similar to cat's claw scratch.
    And overall sado-maso games ...

    WHAT A PITY !!!
    Last edited by Acetronics2; - 21st March 2008 at 12:43. Reason: WHAT A PITY !!!
    ************************************************** ***********************
    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 " !!!
    *****************************************

  6. #6
    Join Date
    Dec 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Default Interrupt mystery -

    Question are you reading porta.0 five times or porta.0,1,2,3,4,5
    just a question on interpation of you code

    MIke

  7. #7
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mbruno View Post
    Question are you reading porta.0 five times or porta.0,1,2,3,4,5
    just a question on interpation of you code

    MIke
    this syntax allows me to read porta bits starting from bit0, not documented in pbp pro manual but explain in a forum and tested succesfuly. this is a way to access port bits with an index.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xnihilo View Post
    this syntax allows me to read porta bits starting from bit0, not documented in pbp pro manual .
    FALSE :

    Last manual

    $5.66 ...

    Once more dead ...

    Alain

    GAME OVER ... tadaaaaaa !
    ************************************************** ***********************
    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 " !!!
    *****************************************

  9. #9
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    I do hate war games ... ( except the film ...) BUT

    Code:
    FOR i = 0 to 5
        aport[i] = porta.0(i)       'mirror the pins states into the array
    NEXT i
    Are you really sure of those lines ... ???
    Yes. You can try it.

    Alain

    PS
    Code:
        IF dead == 1 THEN finish    'if player is already dead, don't answer and leave the int routine
    Ha,ha,ha ... YOU 're dead !!!
    What do you mean?
    Re-PS

    Code:
    The PICs control transistors that drive relays for 9V supply to nichrome wires for the physical feedback. 
    One cm of 38ga Nichrome wire, with 9V and a 6 ohms resistor is heated for 500ms, inducing a little burn that will leave a very tiny scar similar to cat's claw scratch.
    And overall sado-maso games ...

    WHAT A PITY !!!
    It is a lasergame with physical feedback an recoil.

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


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by xnihilo View Post

    Yes. You can try it.

    >>> NO !!! Won't work ...



    What do you mean?

    >>> I leave your routine where it is ...


    It is a lasergame with physical feedback an recoil.
    >>> Sado-Maso's little chicken warrior's game : Try it with real ammunition and real ennemies , you won't be so proud ...

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

  11. #11
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Smile

    >>> NO !!! Won't work

    How can you explain it works for me then?

    >>> I leave your routine where it is ...

    Again, i don't understand the meaning of this sentence.

    Sado-Maso's little chicken warrior's game : Try it with real ammunition and real ennemies , you won't be so proud ...

    What chicken?
    It is a game meant to be a role playing game for cqb/mil-sim simulation.
    Like Rainbow Six sgame series on pc.
    What's your problem with that anyway?
    Well that's not the point. I'm not here to discuss about RPG but about interrupts, am i not?

    My idea is that the reason why i get unexpected interrupts is because i enable int for ra3 while this pin is left
    floating... What is exactly the electrical/logical state of this pin (mclr disabled) when enabled as input pin with no external wpu, i don't know.

    Maybe some smartass on this forum knows that

  12. #12
    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...

  13. #13
    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.

  14. #14
    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...

  15. #15
    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

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