bit selection in ports msp430-stk2

i recently bought the msp430x449 stk-2 from olimex and i am programming it using mspgcc and the jtag.

however, i am facing some programmign challenges, which im sure are simple things:

how do i select a bit of a particular port.

for instance, i am trying to select only bit3 of port1 so as to light up the red led only,

so i do this:

  P1DIR |= BIT3;
  P1OUT = 0;

and i have put this in a while loop and invert P1OUT like this:

P1OUT = ~(P1OUT)

this lights up the led when P1OUT goes to 0 and nto when it goes to 1.

however, i have been unable to select the 2 lines of the buzzer and make them sound using the same technique as above. there is sound from some other programs so i knwo that the buzzer is working fine. but those programs are working with the entire port1 whereas i j just want to select the 2 lien for port1 which connect tot he buzzer.

the goal of this experiment is to be able to select one gpio pin (eg. port2 pin 1) for sending signals.

any ideas??

thanks,

karan

Also:

what does P1SEL do??

i am confused as to what is the exact function of these statements:

P1OUT = …

P1DIR = …

P1SEL = …

if we are markign port1 as output by P1OUT = some value (say 0x02) then doesnt that mean that this value is being sent as an output to the port? why do we specifically need to specify DIR as 0xff??

thanks,

karan

read the MSP430 users manual the name is slau056 and it’s on TI web page

it seems you miss some basic knowledge for MSP430 architecture and this is the right document to start with

Best regards

Tsvetan