I2C issue w/ 18F6722


Results 1 to 6 of 6

Threaded View

  1. #2


    Did you find this post helpful? Yes | No

    Default

    Try changing your TRIS registers.

    It looks like you have them set to outputs both clk and data.

    Not sure why you are using asm?
    and you set trisc two time I think you wanted to set port D in the second statement

    Try (without asm)
    PORTC = 0 ; clear portc
    TRISC =%0001000 ;set portc.4 to input all others outputs
    PORTD = 0 ;clear port d
    TRISD =%0010000 ;set portd.5 to input all others outputs

    This matches your IC2READ statements , if you want to use other pins you need to change
    the DATA and clock pin assignments

    TEST:
    I2CREAD PORTC.4,PORTC.3,%01000001,[X] 'DOESN'T WORK - ALWAYS RETURNS DEC 16
    'I2CREAD PORTD.5,PORTD.6,%01000001,[X] 'WORKS
    DEBUG BIN8 X,10,13
    PAUSE 500
    GOTO TEST


    Regards
    Last edited by mark_s; - 16th July 2010 at 00:23.

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