Tool/software: Code Composer Studio
#include <msp430.h>
volatile unsigned int i; // volatile to prevent optimization
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P2DIR |= 0xFF; // Set all pins in port 2 to output direction
while(1)
{
P2OUT ^= 0xFF; // Toggle all port 2 pins using exclusive-OR
i = 50000; // Delay
do (i--);
while (i != 0);
}
}
This is the code I written to toggle all GPIO pins in port 2, but the result is P2.6 and P2.7 pins are not toggled and all other pins are toggled. the same thing I tried for port 1, port 3 and port 4 pins and it is working fine. Can I get to know why it is not working only for these two particular pins.(In my design P2.7 pin used to enable RS485 data).Kindly help me over here.