This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

About P0 and P1

In my application with c167, I want to use PORT0 and PORT1 as general I/O , but it dosen't work. In my application ,I made the
pin EA keep a high level ,and in the code i
initialization the BUSSCON0 as 0 , then i used the ports , but i faild. pls help me ,
and sorry for my poor english! thank you !!

  • Can I ask if you are really using a C167 and not a XC167?

    When you have the pin /EA high and boot from a RESET you are operating in single chip mode. In single chip mode the C167 operates only with and out of internal resources. No external bus is configured and no external peripherals and/or memory can be accessed. Also no port lines are occupied for the bus interface.

    To utilize PORT0 or PORT1 as outputs you simply need to configure the DPxx for the port you want to control. Then you can read or write P0 and P1 as you desire. Please note the registers for P0 and P1 can only be address bytewise (for example P0L, P0H, P1L or P1H).

  • i'm so sorry to say that i had noticed it what you said , but the ports does not work .but thank you all the same.

  • MY CODE is as follows:

    bset P1L.1
    bset DP1L.1
    bset P6.7
    BSET DP6.7
    LGW:
    bclr P1L.1
    NOP
    NOP
    NOP
    NOP
    BCLR P6.7
    NOP
    NOP
    nop
    nop
    nop
    bset P1L.1
    NOP
    NOP
    nop
    nop
    nop
    BSET P6_7
    jmpr cc_UC ,LGW

    the same code with P1L.1 and P6.7 ,has
    different result , P6.7 works well , but P1l.1 doesn't work .
    sorry for my poor english!

  • Q: Can I ask if you are really using a C167 and not a XC167?

    A: the ports does not work .but thank you all the same.

    and some wonder why threads get off track?

    Erik

  • The answer to your question comes back to reading the manual, DP1L is an Extended SFR (ESFR) so you need.

      extr #1
      bset DP1L.1
    

    P.S.
    The reason I asked which device you are using is because the C167 with internal Flash (since 2000) is no longer available (the XC167 is available with internal Flash). Given that you start in single chip mode means your program starts from internal ROM so how are you downloading a program in single chip mode (changing the ROM code is a good trick)? Are you using BSL mode?

  • Thank you Chris , thank you!

    you are right , the problem is that

    DP1L is an Extended SFR (ESFR) .