Skip to content

Instantly share code, notes, and snippets.

@trtg
Last active October 27, 2020 18:10
Show Gist options
  • Save trtg/4451982 to your computer and use it in GitHub Desktop.
Save trtg/4451982 to your computer and use it in GitHub Desktop.
msp430 launchpad sample code to blink LED 1
@HuanyuZang
Copy link

//set up bit 0 of P1 as output
P1DIR = 0x01;

I didn't see any evidence that shows bit 0 of P1 is chosen
If I choose bit 2 or 3? What's the code look like?

@karlpetersonn
Copy link

0x01 is in hex, in binary that's 0000 0001. So, what the line:
P1DIR = 0x01;
is saying is set bit 0 in port 1 direction register high. This sets the P 1.0 to an output pin.

If you said something like 2 or 3 the code wouldn't run because you are trying to output on P 1.0.

TI actually makes this a little easier by defined all the bits in header file so for example you could write this:
P1DIR |= BIT0;
Instead of:
P1DIR = 0x01;

@pvsivakrishna98
Copy link

Can you pls give an idea regarding interfacing Bluetooth with msp430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment