• AVR Freaks

PortB Interrupt-On-Change problems on PIC18F65J11

Author
Waax
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2011/12/12 05:58:02
  • Location: 0
  • Status: offline
2019/07/09 05:20:12 (permalink)
0

PortB Interrupt-On-Change problems on PIC18F65J11

Hello
I have problems with one of our products using a PIC18F65J11. Two data lines (Wiegand Data0 and Data1) are connected to PortB RB4 and RB5. The PortB IOC is configured and and everytime (almost everytime!) a change in the data lines occures the interrupt triggers and in the ISR a check if Data0 or Data1 is low is done. This workes fine. But every now and then a change in one of the data lines doesn't trigger an interrupt.
I found some information in the forum and on a website about an implementation problem regarding PortB IOC on PIC16 and PIC18 families. Here are the links:
https://www.microchip.com/forums/m294169.aspx
http://www.xargs.com/pic/portb-change-bug.html
 
The later website states at the end that the problem is fixed on the more modern PIC18 families:
This issue has been corrected in the PIC30 core by using the output of the input latch as the input to the change latch. It has also been corrected in the enhanced midrange line (PIC16F1xxx) and modern PIC18 families (PIC18FxxK40 and later).

 
My question now, is the implementation problem fixed on the PIC18F65J11? Because the implementation problem described by the websites matches my problem.
 
Thanks for any help
#1

4 Replies Related Threads

    ric
    Super Member
    • Total Posts : 22654
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PortB Interrupt-On-Change problems on PIC18F65J11 2019/07/09 05:34:51 (permalink)
    0
    The PIC18F65J11 is part of the "PIC18F85J11 FAMILY", which was released in 2006.
    The K40 devices came out in 2016, so 10 years later.
    So your part is not a "modern PIC18" device.
    Your datasheet contains the magic phrase:
    "Polling of PORTB is not recommended while using the interrupt-on-change feature" ...
     
     
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    Waax
    New Member
    • Total Posts : 17
    • Reward points : 0
    • Joined: 2011/12/12 05:58:02
    • Location: 0
    • Status: offline
    Re: PortB Interrupt-On-Change problems on PIC18F65J11 2019/07/09 06:54:04 (permalink)
    0
    Thanks for the quick reply.
    OK - I do have the issue on the PIC18F65J11. But to my understanding I am not polling the port. I made sure that during normal execution no reads are done on PortB. Only once the IOC triggered and execution is in the ISR the pins RB4 and RB5 get read to see if they are low. IMO polling is constantly reading the state of the port.
    Anyway - reading the port a second time as suggested doesn't solve the problem. Every now and then the system misses a state change on RB4 or RB5.
    #3
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11208
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: PortB Interrupt-On-Change problems on PIC18F65J11 2019/07/09 09:41:39 (permalink)
    0
    IMO polling is constantly reading the state of the port.

     
    No, polling means reading the state, period.  And note the article also says, "Other data sheets specifically warn that interrupts can be lost by polling PORTB, and Microchip forum users have reported cases of interrupts being lost."
    #4
    Waax
    New Member
    • Total Posts : 17
    • Reward points : 0
    • Joined: 2011/12/12 05:58:02
    • Location: 0
    • Status: offline
    Re: PortB Interrupt-On-Change problems on PIC18F65J11 2019/07/10 23:20:17 (permalink)
    0
    OK - thanks for the information.
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5