Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Basic Control Register Control for LED Blink Issue

$
0
0

Hello everyone,

 

I am new to MSP430G2553 and a beginner at programming. But I am trying to do something simple to start off which is to do the blink example, but without using digitalWrite and instead using P1DIR/P1OUT/etc.

 

Goal: Take the MSP430G2 Launchpad Development Board and blink P1.6 only.

 

Issue: I noticed that the following code doesn't work and that I need to initialize P1.7 along with P1.6 for it to work:

 

void setup() {                
// initialize pin 1.6 as output
P1DIR = 01000000;
}
 
// the loop routine runs over and over again  to blink the LED:
void loop() {
  P1OUT = 01000000;
  delay(1000);               // wait for a second
  P1OUT = 00000000;
  delay(1000);               // wait for a second
}
 
 
 
-----------------------The code below works fine (initializing P1.7 as well)------------------------------------
 
void setup() {                
P1DIR = 11000000;
}
 
// the loop routine runs over and over again  to blink the LED:
void loop() {
  P1OUT = 11000000;
  delay(1000);               // wait for a second
  P1OUT = 00000000;
  delay(1000);               // wait for a second
}

 


Viewing all articles
Browse latest Browse all 2077

Trending Articles