I2C Effects on other PortA pins


Closed Thread
Results 1 to 3 of 3
  1. #1
    kenmac's Avatar
    kenmac Guest

    Default I2C Effects on other PortA pins

    Hi,
    I'm using a 16F628A and Picbasic compiler (not Pro), which uses the default pins PortA.0,1 for I2C comms.
    When the I2C function is active, should it affect the other PortA pin states?
    The program I am working on uses PortA.7 as an output, which needs to be locked when in the "on" state, because it controls power on/off of external equipment
    However, I notice that it is interrupted every second ( the I2C is a RTC read function) for a short time, giving it about a 90% duty cycle over one second.
    I know that the routine for I2C is in the PBL.inc file - does it read/write to PortA as the full Register or only the two I2C bits?
    If the former, is it possible to customise/modify the routine to include an "Or"ing of the necessary locked PortA.7 state?
    All other pins are used in both Ports, so I can't reallocate the I2C pins.
    Currently I have overcome the problem by trapping the short changes in the external equipment, but in other instances this may not be possible, so it should be cured at the source, if possible.
    ??

    kenmac

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I2C action is limited to the SCL and SDA pins you have defined (you haven't said what version of compiler you've got - just in case it's some ancient issue from years ago). The 16F628 has analog comparators which in certain modes can cross-connect some pins (see schematics in Comparator Section in Datasheet), but if you have disabled Comparators and the Voltage Reference Module this won't happen and it certainly won't happen with PortA.7 whose only commonality is with the Oscillator circuitry. You may have some bum code, or more likely a short between pins on your PCB or Breadboard since RA7 (your problem pin) and RA0 (your I2C pin) are adjacent.

  3. #3
    kenmac's Avatar
    kenmac Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks Melanie,
    The Compiler is V1.45 and Programmer is WinPicProg V1.95.
    Fuses set for Watch Dog, Power Up, Brown Out, Int Osc.

    I am aware of the 16F628A pins setup.
    This is not a hardware problem.
    Also, it appears to affect all portA pins being used as output.
    I didn't notice that before because the other pins are normally held at low (0) when I2C is called.
    It's definitely an effect of the I2C actions - the interruption of the output is exactly in synch with the 1 second polling of the RTC!
    I have also tested the circuit on a protoboard - it does the same.
    Unfortunately I don't know much about Assembly coding, so I can't interpret the I2C routines in the PBL.inc file.
    As you know, when writing to the portA register we mask out any other pins to retain their state.
    Is this also the case with the I2C routines - do they write as a complete byte or are they capable of writing to single pins alone?
    The effect is similar to a non-masked write.
    After the interruption, the affected pin restores to it's correct state due to the program loop.
    Viewed on a LED, you see a mainly "On" state, with a visible short interruption at a "one second" rate.

    kenmac
    Last edited by kenmac; - 11th July 2005 at 09:48. Reason: more info

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. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. Another I2C Slave Routine Problem
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2009, 05:50
  4. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  5. Please help with i2cslave i2c slave
    By cycle_girl in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st December 2005, 13:55

Members who have read this thread : 1

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