I2CWRITE and 18F4680


Closed Thread
Results 1 to 40 of 41

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    @ __CONFIG _CONFIG4L, _LVP_ON_4L & _STVREN_ON_4L & _XINST_ON_4L & _DEBUG_OFF_4L
    'Single supply ICSP ENABLED
    'Stack Overflow reset is ENABLED
    'Enhanced CPU is ENABLED
    Unless your programmer use this pin to program your PIC, high unlikely, you want to use LVP_OFF, unless it may not work as expected.

    Second test, use the internal OSC or lower value for the external.
    Steve

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

  2. #2
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default

    Thanks to both.
    Mr. E, I have changed the code to:
    @ __CONFIG _CONFIG4L, _LVP_OFF_4L & _STVREN_ON_4L & _XINST_ON_4L & _DEBUG_OFF_4L

    AND changed the oscillator to 20 MHz:
    DEFINE OSC 20

    and now BOTH lines are low all the time.......

    This is confounding, I am certain it will be a simple thing but I can not see it..... however, I do smell a lot of pine....... <grin>.

    Again, any help no matter how critical would be appreciated. Datasheet reading have proved as helpful as the tea readings.......

  3. #3
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default

    UPDATE-
    I built another test board (had several made overseas) and it does the same thing. Also tried another 6 pin programming cable - same thing.

    Tried different I2C defines such as
    define I2C_HOLD 1
    define I2C_SLOW

    with no luck, lines are either fixed at both high or one is high and the other is low - this should be telling me something - just don't know what it is.......

  4. #4
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default

    OK, I have tried more things, but no difference:
    i2cwrite idata,iclock,$2E,$06,[$00,$00]
    pause 20

    The idea is to force the R/W bit (0) to low for a write to the registers and telling the 23016 that both ports are outputs.

    BOTH the clock and data lines from the proc are high and do not wiggle at all under I2C commands but still can be made to wiggle under the HIGH and LOW coomands for individual pins.

    Still appears that no matter what I try to do with the I2C commands, the pins are silent.....

  5. #5
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default

    OK, more news which leads me to wonder if I2C commands work on this 18F4680 device.
    I changed the clk and data pins to the serial pins on which I have status LEDs for the serial part when I get to that.
    The LEDs did not toggle as they should either.

    Does anyone know how to troubleshoot the compiled code to see if this is compiling correctly?

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


    Did you find this post helpful? Yes | No

    Default

    Are you using a OSC module or crystal?
    Steve

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

  7. #7
    Join Date
    Sep 2007
    Location
    Waco, Texas
    Posts
    151


    Did you find this post helpful? Yes | No

    Default Oscillator

    I am now using a 20 MHz oscillator fed into A.7
    I also tried downloading the MPASM again from the MELABS site - no change.....

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