Pic16f88-I2c-Interrupt PORTB...


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2005
    Posts
    23

    Default Pic16f88-I2c-Interrupt PORTB...

    I'm using a Pic16f628 , a PCF8524 to drive some Leds and a 24c08
    Now i added a PIC16F88 to use its hardware I2c.
    At this point everything ok reading and writing on I2c bus.

    Problems arise when i set the interrupt on PORTB on pic16F88.
    I thought about SCL pin (PORTB4) wasn't affected by interrupt because used by I2C Hardware but i get interrupt everytime the other Pic read or write on I2c network BUT i want an interrupt only on the three left pins of portB.

    I2c hardware does not overrides PORTb interrupt so PORTB4 (SCL) is a normal input port like PORTB.5/6/7.

    Am I missing some register settings?
    I set :
    CMCON=$07
    ANSEL=0
    ADCON0=0
    SSPCON=%00100000 'MASTER I2C

    Thanks.
    Roberto


    Greetings from 2006 Winter Olympic City

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    Oh,

    out of the datasheets there is no solution...

    It looks like the SSP-device is interfering the PortB-Change-INT.

    Has You asked the technicans on support.microchip.com ? Just open a new ticket !
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    Apr 2005
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    Answer From Microchip ticket:


    I'm sorry, but this is a known errata issue.

    http://ww1.microchip.com/downloads/e...doc/80171j.pdf

    7. Module: PORTB Interrupts
    When the PORTB interrupt-on-change feature and
    a PORTB peripheral are enabled simultaneously,
    the PORTB peripheral input signal’s rising and
    falling edges will trigger an interrupt-on-change
    event. This is due to the interrupt-on-change
    feature not being disabled on the respective pin for
    that peripheral when it is enabled.
    The affected pins and peripheral signals on
    PORTB are RB4: SCK and SCL, RB5: SS and
    RB6: T1CKI. The functionality of T1OSI (RB7),
    T1OSO (RB6) and TX/CK (RB5) is not affected by
    this issue.
    Work around
    None.

    But the big problem are the last words.......Work around = none.

    Roberto

  4. #4
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Roberto,

    Why not consider using a 16F872 or another PIC (16F877) that has the SCK and SCL on Port C so that you can continue using the Port B interrupt change? More pins, more possibilities!

    BobK

  5. #5
    Join Date
    Apr 2005
    Posts
    23


    Did you find this post helpful? Yes | No

    Thumbs up

    Hi BobK,

    yes i did it, considering 16F876.
    Unfortunately i have to make again the pcb , and the most part of pins are useless to my project ( i use 8 pins only)...but things are gone this way.

    So if you use I2c slave DONT use portB interrupt.

    I regret that i spent a lot of time thinking i was writing bad code or made bad soldering..but i thanks MicroChip staff for their quick response to my question.



    Roberto

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,820


    Did you find this post helpful? Yes | No

    Default

    I know its been too long but now I am in the I2C too and looking around for Interrupt solutions found this thread.

    If I may suggest to use interrupts on PORT B but discriminate in the ISR where that interrupt came from in the first place. If it was by I2C then serve I2C_ISR else serve OTHER_BIT_ON_PORTB_ISR.

    Just an idea if it is not tooo late!

    Ioannis

  7. #7
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    The 16F88 doesn't have a hardware Master I2C. It's got Slave & Master SPI, but for I2C it's only Slave. You have to hard-code (i.e. use your basic commands for s/w I2C) the I2C master on this one.

    See the datasheet...pg 89 shows the only master option as "firmware controlled" (meaning it's not in hardware). Besides that, your SSPCON settings were for SPI master, despite your comment indicating I2C.

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 19:52
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  4. shifting problem
    By helmut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 31st August 2007, 06:11
  5. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10

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