This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Unable to select a specified pin

Other Parts Discussed in Thread: MSP430G2452

 

        I wrote this piece of code to generate a 25% PWM. But the problem is that it generates the output only when pin is set to BIT2.

 

Can anyone tell me the reason the problem with the piece of code that I am using.                                                            

 

 

#include <msp430g2452.h>

 

void main(void)

{

  WDTCTL = WDTPW +WDTHOLD;              

  P1SEL |= BIT2;                  // problem arises when i set it to BIT3 

  P1DIR |= BIT2;                     // problem arises when i set it to BIT3        

  CCR0 = 1024;                             

  CCTL1 = OUTMOD_7;                  

  CCR1 = 256;                            

  TACTL = TASSEL_2 + MC_1;              

 

  _BIS_SR(LPM0_bits);                    

}

  • Each pin of the chip has a limited number of functions.

    For example, Pin#1 is for Vcc only. You cannot use it as a digital input pin. You cannot use it as a digital output pin. You cannot use it as an analog input pin.  ... etc.

    Conversely, each function of the chip is available on a limited number of pins.

    For example, TA0.1 is available on Pin#4 and Pin#13 only. It is not available on Pin#1. It is not available on Pin#2. It is not available on Pin#3. It is not available on Pin#5. ... etc.

    See the "Device Pinout" of the Data-sheet.

**Attention** This is a public forum