The MSP has a couple of ports, each having eight bits in most cases, some have less if the device is small. So there could be... Port 1 BIT0 BIT1 BIT2 BIT3 BIT4 BIT5 BIT6 BIT7 Port 2 BIT0 BIT1 BIT2 BIT3 BIT4 BIT5 BIT6 BIT7 Each port has different registers like a DIR (direction), OUT (output), IN (input), SEL (select), ... For port 1 all these registers would be P1DIR, P1OUT, P1IN, P1SEL, ... For port 2 all these registers would be P2DIR, P2OUT, P2IN, P2SEL, ... The eight bits of each port can now be addressed individually - "BIT0" is a definition for 0x01, "BIT1" for 0x02, "BIT2" for 0x04, ... So if you want to set BIT2 of port 2 to output direction, you have to set P2DIR |= BIT2; or P2DIR |= 0x04;
↧