I2CWRITE and 18F4680


Closed Thread
Results 1 to 40 of 41

Hybrid View

  1. #1
    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.....

  2. #2
    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?

  3. #3
    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.

  4. #4
    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.....

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


    Did you find this post helpful? Yes | No

    Default

    Don't forget, the timeout label OF I2CWRITE perform a GOTO not a GOSUB, maybe why you have odd results.... stack underflow.

    What happen if you loop within the INIT section?
    Code:
    init:
            pause 1000 'Hold here for a bit while things IPL......
            LCDOUT $FE,1,"I'm alive!"
            heart=1 'Turns off HEARTBEAT led
            fault=1 'Turns off FAULT led
            for i2c_addr=0 to 7
                 i2cwrite idata,iclock,$06,i2c_addr,[$00,$FF] 'Sets GP0.0-GP0.7 as OUTPUTS
                 pause 20
                 i2cwrite idata,iclock,$07,i2c_addr,[$FF,$00] 'Sets GP1.0-GP1.7 as INPUTS
                 pause 20
                 next
            GOTO init
    Last edited by mister_e; - 16th May 2008 at 18:44.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default Thanks for the response and interest.....

    Mr. E-
    I added a GOTO at the end of the INIT section (tight loop) and still the pins don't reflect any movement - they are both high.

    BTW, MPASM 5.14, MCS 2.3.0.0, PBP 2.47.

    I am no Guru but have coded before and this is driving me nuts! 2 different board designs but using the same chip gives the same symptom.......I swear it seems that the command offers no response.

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


    Did you find this post helpful? Yes | No

    Default

    Is the LCD's working?
    Steve

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

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