SnapMagic Search logo ☰
About
For Engineers >
Build Parts Request Parts Browse Parts Pricing Q & A PCB Suppliers
For Part Vendors >
Publish Media Kit SnapInsights Get CAD Models Syndication Program Contact Us
Log In Sign Up
  • Questions /
  • How to solve MSP430 blinking led

How to solve MSP430 blinking led

0

I started using MSP430 Launchpad and as I was examining the code for blinking a led I found something odd. The code is this and is a ready example:
http://www.kynix.com/uploadfiles/pdf2286/MSP430F1481IRTDT.pdf
#include <msp430g2553.h>

unsigned int i = 0;

void main(void)
{
WDTCTL = WDTPW + WDTHOLD;

P1DIR |= 0x01;

for (;;)
{

P1OUT ^= 0x01;

for(i=0; i< 20000; i++);

}
}
In the beginning you have to initialize P1DIR so to set the pin in which the led is connected to output. I searched a lot and everywhere is says that the specific register is just to set the direction. So then I deleted a part of the code and the remaining was this one:

#include <msp430g2553.h>

unsigned int i = 0;

void main(void)
{
WDTCTL = WDTPW + WDTHOLD;

P1DIR |= 0x01;

for (;;)
{

}
}
Here is the odd part. The led is on!Shouldn't be off? The line of code with P1OUT isn't going to say to MSP if the led is on or off? With only P1DIR nothing should happening. What am I doing wrong?

General Question

Added 8 years, 7 months ago.

B
Bartowski

0 Answers

Add a Response

Sign up or log in to respond.

SnapMagic

  • About
  • Contact
  • Pricing
  • Careers
  • 💎 What's new

Community

  • Our Community
  • Q & A
  • Blog
  • Made With SnapMagic Search

Product

  • Parts Library
  • InstaPart
  • InstaBuild
  • Plugins
  • API
  • PCB Suppliers
  • SnapMagic Search Desktop App

Tools

  • Allegro
  • Altium
  • Autodesk Fusion
  • CircuitStudio
  • CR-8000/CR-5000
  • DesignSpark
  • DipTrace
  • Eagle
  • Easy-PC
  • eCADSTAR
  • ExpressPCB Plus
  • KiCad
  • OrCAD
  • PADS & DxDesigner
  • PCB123
  • P-CAD
  • Proteus
  • Pulsonix
  • Target 3001!

Support

  • FAQ
  • How to Import
  • Standards
  • Contact Us
  • Design Resources
  • Terms Of Service
  • Privacy

Join Our Newsletter

Your subscription could not be saved. Please try again.
Thanks for subscribing to the SnapMagic Search newsletter. We're excited to have you as part of our community.
  • Facebook
  • LinkedIn
  • Twitter

1-844-625-8890

© 2013 - 2025 SnapMagic

25be24a220e74ad8ad72be2a8fa00216