Announcement

Collapse
No announcement yet.

16LF1904 MCU, DEFINE OSC and I2C Commands(Write and Read) are not working properly.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 16LF1904 MCU, DEFINE OSC and I2C Commands(Write and Read) are not working properly.

    I am using 16LF1904 MCU in my project.

    1-)I need Internal oscillator at 16MHz.DEFINE OSC 16 command ( DEFINE OSC 4 command also have same result).Frequency is measured at clk_out pin (Fosc/4)=125Khz.(Default OSC value=500kHz)
    There is no any stack over flow or compliler errors.

    2-)I2C write and read commands are also doesn't work.CLK and DATA pins have already PULL-UP resistors and the level is 3.3V after reset but when the code line executed the level is set to zero always.

    Thanks for your interest and help.Regards.
    Ali Tabakoglu

  • #2
    1-) You need to set the OSCCON register.
    The default at power-on is 500khz.
    For 16Mhz use ...
    Code:
    OSCCON = %01111010
    2-) You may need to enable digital inputs on the analog pins.
    Code:
    ANSELA = 0
    ANSELB = 0
    ANSELE = 0
    PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
    Never download a PIC datasheet from anywhere but microchip.com

    Comment


    • #3
      16lf1904

      Thanks for your info.
      Best regards

      Ali Tabakoglu

      Comment

      Working...
      X