Menu

I2C with PIC24FJ series?

Holger
2014-02-16
2014-02-16
  • Holger

    Holger - 2014-02-16

    Ok, I'm abit stymified here. I try to initialize the I2C1 on a PIC24FJ64GA002. After some days with forth I eventually tried it in Assember, where it works. But on forth I don't even seem to be able to set the registers, i.e. a

    $9000 $0206 ! $0206 @

    will return 0 on the stack. I even went so far as to change the "!"- routine into

    mov.w [W14--], W0
    mov.w #0x200,W1
    cp w0,w1
    bra LTU,jmp1
    mov.w #0x210,W1
    cp W0,W1
    bra GTU,jmp1
    nop ; this is the breakpoint for I2C1-tests
    nop
    jmp1:
    mov.w #PFLASH, W1
    cp W0, W1
    bra GEU, STORE1
    mov.w [W14--], [W0]
    return

    to have a look into the registers, but it looks as if "mov.w [W14--], [W0]" simply won't write within the range $200 - $220

    Anything I'm missing?

     

    Last edit: Holger 2014-02-16
  • Mikael Nordman

    Mikael Nordman - 2014-02-16

    Yes, FF disables all unused peripherals.
    Check the PMD registers.
    Mike

     
  • Holger

    Holger - 2014-02-16

    Ts! I checked the PMD at Microchips reference and I checked the PMD in Assembler & at FF reset. But I didn't check it after FF initialized itself.

    Now it works (i.e. I may at least set the registers)

    Thanks

     

    Last edit: Holger 2014-02-16

Log in to post a comment.