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

Mode Ports

Hi!
In Hello example for 8051 by MCB900 in main() there is:
P2M1=0;
P1M1=0;

Is it ok??
Im reading the datasheet of de microcontroller and i dont understand it, because to configurate the port is using PxM1 and PxM2. Then why is writed these (bold text)??
Thanks

Parents
  • Let's be a bit more specific: Have you read the chapter (I think it is chapter 5) in the user manual, where the individual bits of the port mode registers are described?

    That chapter tells explicitly what mode the I/O pin will use for any bit combination in P1M1/P1M2 and P2M1/P2M2.

    Note that the code only writes to P1M1/P2M1 and not to P1M2/P2M2 so they are keeping their defaults.

    Now it should be quite easy to:
    1) Figure out what the default values are for P1M2 and P2M2.
    2) Figure out what a 0 in P1M1/P2M1 means together with the value of P1M2/P2M2.
    3) Decide if that pin mode is suitable for the specific hardware you run on.

    The schematics for the board is also available on this web site.

    Please come back with specific questions when you have looked through that chapter, looked at the initial value for the 'different SFR and looked at the schematics.

Reply
  • Let's be a bit more specific: Have you read the chapter (I think it is chapter 5) in the user manual, where the individual bits of the port mode registers are described?

    That chapter tells explicitly what mode the I/O pin will use for any bit combination in P1M1/P1M2 and P2M1/P2M2.

    Note that the code only writes to P1M1/P2M1 and not to P1M2/P2M2 so they are keeping their defaults.

    Now it should be quite easy to:
    1) Figure out what the default values are for P1M2 and P2M2.
    2) Figure out what a 0 in P1M1/P2M1 means together with the value of P1M2/P2M2.
    3) Decide if that pin mode is suitable for the specific hardware you run on.

    The schematics for the board is also available on this web site.

    Please come back with specific questions when you have looked through that chapter, looked at the initial value for the 'different SFR and looked at the schematics.

Children
No data