Wednesday, December 10, 2014

MSP430 multitasking





     Hello everyone. I am vignesh raja. Here we are going to see about how to implement multitasking concept in msp430. Multi Tasking is defined as doing two or more function at same time but independently each other. One function doesn’t affect other function. Basically when we use delay function in the program of microcontroller when delay function runs we can’t do any other function and condition checking except interrupt. Because delay function use whole cpu. Instead of delay we are going to use millis() function from energia software’s pre de fined functions. Using this millis() function  we are going to achieve  multi tasking. The msp430 ic has inbuilt timer. What millis() function does is that running time on that timer when ic get powered. It prints the count of current millisecond. If ic runs for exactly one second from when it powered it print count of millisecond as 1000. Because the 1000ms is equal to one second. The milis() count approximately get counts for 53 day . After 53 days it get resetted  . but no problem the resetting doesn’t affect output.

Here in this video I programmed msp430 launch pad to perform two functions run at the same time. One function led blink with interval of one second and other function is when the push button pressed then it will print some string in serial monitor. Here what I did to provide delay between led blinking is just seeing the millis() function time using if condition . it just like we watch the time and do work as per time. At first The program set the millis() value into a variable (current_Millis)  and assign a variable(previous_Millis) with zero value. And IF condition check subtraction between current_Milis variable and previous_Millis variable equal to 1000. If the condition is true then it changes the current led state. If led is high then it become low and vice versa. So here we are didn’t using delay instead of that we are using condition checking for time. So at mean time of this function the cpu is free. So it can able to check other function also. So here I did other function push button checking.  So both function work at same time. Multi tasking is achieved in the microcontroller. Below I provide the code use it and share your opinion in comment.
                                                               


coding:


const int ledPin = P1_0;    // set P1.0 as led pin
int button = P1_3;            // P1.3 conneted with push button in msp430 board
int ledState = LOW;            // led state
long previousMillis = 0;         // hold last millis value
long interval = 1000;           // time intervel to provide delay for led function
 void setup() {
pinMode(ledPin, OUTPUT);           // set led pin as output
pinMode(button, INPUT);            // set button as input
Serial.begin(4800);              // start serial communication at the baud rate of 4800
}
void loop()
{
unsigned long currentMillis = millis(); // saving current millis() value to a variable
if(currentMillis - previousMillis > interval) { //comparing subtraction of current millis value to privious millis value with intervel 1000ms = 1 sec 
previousMillis = currentMillis;           // after comparision assigning current millis to previous one
if (ledState == LOW) //check led state if it is low make it as high
ledState = HIGH;
else
ledState = LOW;  // if it is high make it as low
digitalWrite(ledPin, ledState);   
}
if (digitalRead(button)== LOW){      // check button is pressed 
Serial.println("button pressed!");  // if true then print this string serial monitor
}
}



Thank you for reading.


  

Thursday, November 20, 2014

Touch switch for MSP430 launchpad


Hello everyone
     
            I am  vignesh raja. here i share my project Touch switch for MSP430 launchpad. Visit  the video above for more details. And here the link below to get step by step instruction to built this project:

http://www.instructables.com/id/Touch-switch-for-MSP430-launchpad/

Thank you for watching

Monday, November 10, 2014

MSP430 serial communication using energia and processing



Hello everyone
       
            I am  vignesh raja. here i share my project MSP430 launchpad serial communication using energia and processing. Visit  the video above for more details. And here the link below to get step by step instruction to built this project:

http://www.instructables.com/id/MSP430-SERIAL-COMMUNICATION-USING-ENERGIA-AND-PROC/


                                                       Thank you for watching

Friday, November 7, 2014

MAGIC CUBE USING MSP430


Hello everyone
        
            I am  vignesh raja. here i share my Led paper cube project using msp430 launchpad. Visit  the video above for more details. And here the link below to get step by step instruction to built this project:

http://www.instructables.com/id/MSP430-MAGIC-CUBE/


                                                       Thank you for watching

POV using MSP430





Hello everyone
        
            I am  vignesh raja. here i share my POV project using msp430 launchpad. Visit  the video above for more details. And here the link below to get step by step instruction to built this project:

 http://www.instructables.com/id/POV-USING-MSP430-LAUNCHPAD/


                                                       Thank you for watching

                         

Solar Tracking Device using msp430g2231




Hello everyone
    
            I am  vignesh raja. here i share my solar tracking device project using msp430 launchpad. Visit  the video above for more details. And here the link below to get source code  and circuit diagram of this project:
http://www.instructables.com/id/solar-tracking-device-using-msp430/

                                                    Thank you for watching



Introduction

    
 


       Hello everyone . I am vigneshraja. In this blog i share my MSP430 launchpad projects.I hope every one like my project. Here i give a video and link for built these project for every project.


To get  projects using arduino visit my youtube channel link below:
https://www.youtube.com/channel/UCWaG28lbIhQ7_bA-C98HjIw

and subscribe in my youtube channel to get more videos


Thank you for Reading.