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.

MSP430G2231

Other Parts Discussed in Thread: MSP430G2231

Hey ppl, 

I need a clarification regarding the MSP430G2231. As per my knowledge of MSP430G2231 when we switch on the microcontroller all the Ports are configured as input ports.

But the registers in CCSv4 when i debug a simple program also gives following configuration.(I have not configured any thing nether P1SEL, P1DIR, P1REN)

P1.7 = 0x00;

P1.6 = 0x00;

P1.5 = 0x00;

P1.4 = 0x00;

P1.3 = 0x01;

P1.2 = 0x01;

P1.1 = 0x01;

P1.0 = 0x00;

How do i make the p1.1,p1.2,p1.3 ports as input ports??? pls reply.. 

Thanking you,

MANOJ KUMAR S
        INDIA 

  • Hi Manoj,

    although questions like this are better in the MSP forum, I will try to help you here.

    Basically you need to set the P1DIR register, as I suspect you seem to know.  In this case setting P1DIR=0x00; will set all pins as input.  

    If you simply want pins 1, 2 and 3 as input you can set P1DIR to 00001110b = 0x0E

    I hope this helps.   There are many good resources out there to learn the MSP as well.   Perhaps a good start is the wiki.

    http://processors.wiki.ti.com/index.php/MSP430

     

    Best Regards,
    Lisa

  • Hi Manoj,

    sorry I meant 0x00 ... not 0x0E ...

  • Hi Manoj,

    I thought I would post one clean answer for you.

    Basically you need to set the P1DIR register, as I suspect you seem to know.  In this case setting P1DIR=0x00; will set all pins as input.  

    If you simply want pins 1, 2 and 3 as input you should use a bit mask to set/toggle just these.  Eg to set bits, typically an AND mask.  In this case you want bits 1, 2 and 3 to be 0, so you would use the mask 11110001 = 0xF1.

    P1DIR &= 0xF1;

    I hope this helps.

    Best Regards,
    Lisa

  • simply set P1DIR = 0X00; then all will behave as input pin.

                                       or

    set P1DIR = 0xF1; pin 1.1,1.2,1.3 will behave as input rest as output