I2C clock frequency?


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166

    Default

    Qacer, When it does the compile it uses the "OSC=" directive to calculate the data output rate. Make sure you are declaring the OSC=20 if you are using a 20Mhz. oscillator.

    Dave Purola,
    N8NTA

  2. #2
    Qacer's Avatar
    Qacer Guest

    Default

    Thanks, Dave!

    Coincidentally, I'm trying to figure out the oscillators used in the PIC12F675. I have not quite figured out that part, yet.

    Do I need to define OSC every time I use the I2C routine?

    Thanks again!

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    The internal oscillator of the 12F675 run at 4MHZ. if you want to run @29MHZ you must use an external Crystal or a ceramic resonator.

    The DEFINE OSC must be place somewhere on the top of your code and you don't need to write it every time.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Qacer's Avatar
    Qacer Guest

    Default

    Thanks!

    Would serial communication with a 400KHz I2C device still work if my PIC oscillator setting is at 4MHz?

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    of course yes, if not we should all use 400KHZ or less as oscillator. PBP generate the right clock frequency for you. Look in the manual in the I2CREAD/I2CWRITE
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Qacer's Avatar
    Qacer Guest

    Question

    By the way, I wanted to use the internal 4MHz oscillator. From what I heard, that the frequency of oscillation might not be as stable. Would I2C communications still work if I go this route?

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Unstable yes and no. At least, i would never trust too much a serial communication RS232 or else running with any internal or ceramic resonator. Worst if the final product maybe use in various ambient temperature.

    For I2C... i never got issue even by running internal OSC... well as now
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  4. I2C function... clock pin?
    By Qacer in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd February 2006, 22:09
  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 : 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