Download Code Uploaded to the Msp430 Composer Studio

TheMSP-EXP430G2 is a Evolution Tool a.k.a LaunchPad provided by theTexas Instruments to learn and practice on how to use their Microcontrollers. This lath falls under the MSP430 Value Line category where we tin program all the MSP430 series Microcontrollers. Learninghow to use TI Microcontrollers would definitely be a mighty tool upwards in our sleeve because TI is really huge and has a wide verity of MCU'southward to choose from for a very less competitive toll.

We already covered detailed commodity on using Energia IDE with MSP430. In this tutorial we will learn about Code Composer Studio and how it is used to program MSP430. This tutorial is written for very beginners and no hardware is required except the MSP430 board and a figurer. At the end of this tutorial we will be able toBlink the onboard LED of MSP430.

MSP-EXP430G2 Evolution Board:

The gorgeous red color board is the MSP-EXP430G2 Development Board. This board can plan TI Microcontrollers that fall nether the MSP430 serial. The master purpose of this lath information technology to upload code from the figurer to the MCU and read series data from the MCU for debugging purpose. It too provides the pin-out for each pin of the MCU and also two LEDs and a push button button to brand development easy. The board has evolved a lot since its launch and the i shown below is theMSP_EXP430G2 Rev1.5.

MSP430G2 LaunchPad PartsMSP430G2 LaunchPad Parts

TheMSP430G2553 has improve specifications than the other series, it also has a UART module which would be very handy while debugging usingCode Composer Studio. Hence in this serial of tutorials, we will be using the MSP430G2553 to explore all the functionalities of this Development kit.

Powering and Testing the evolution board :

Before we showtime annihilation TI would accept alreadyuploaded a sample Program on your MSP430G2553 Microcontroller, so let united states of america power the board and check if it is working. You lot can power board through the mini USB jack and in one case you do information technology, you should observe the LEDs (reddish and green) at the bottom left corner of your board glowing alternatively. Y'all can then printing the push button connected to P1.3 to cheque if the internal temperature sensor is working. Aye, theMSP2553 has an internal temperature sensor, after pressing the button simply rub your fingers to warm it up and place it on the IC yous tin notice the Red LED turns on to indicate the rise in temperature. Cool!! Right?? Okay now, let us move on to the Software Surroundings.

Programming Software (IDE) for MSP430 LaunchPad:

Texas Instruments allows united states of america to programme their Microcontrollers through a variety of Environments. The Official i is the Code Composer Studio commonly known every bit the CCS. This software is available free of cost. Besides, it requires some minimal level of feel with Microcontrollers. Don't worry we will cover every pace to go familiar with CCS.

There is 1 more than IDE available to write our programme i.e. Energia IDE. So, what is the deviation between CCS and Energia IDE. We already covered Energia IDE in our previous Tutorial.

Energia IDE vs. Code Composer Studio:

Energia is an Open source and free Environment that enables us to program the TI Microcontrollers easily. The main aim of Energia is to make programming TI MCU's equally easy as programming in Arduino. So Energia is an Equivalent for Arduino that supports Texas Instruments Microcontrollers. People who take used Arduino will agree more on this once they download and launch the Energia IDE.

Code Composer Studio (CCS) is a more than versatile professional person IDE which has more functionalities and capabilities in terms of accessing the inside architecture of microcontroller. It has inbuilt debugging role which can check errors in your lawmaking and you can run your lawmaking line by line that helps in finding error without whatsoever headache. It volition have old to become comfortable with CCS. Once you set with this awesome software, trust me you volition get to know annihilation virtually a item microcontroller. You have to take assistance of Datasheet of the microcontroller to write your program.

If you are washed with Arduino iDE or Energia IDE, change your coding environment to CCS, it is well-nigh enervating software in Industries.

Downloading and Launching the Code Composer Studio:

This software is available at Texas Instrument's website without any toll. And so, you can download it from the given link Download link .We will employ Code Composer Studio V7 just you can download latest version also, procedure remains same.

Download and Launch the Code Composer Studio

Either you can download whole software using spider web installer or download setup/off-line installer. This software is quite heavy around 1GB so, you need to wait until it finished downloading.

Afterwards downloading the software, open it and install.

When yous click on setup, but similar any other software yous volition be asked to agree terms and conditions and to select the installation binder. Afterwards that you have to choose boards for which you desire to download files. In our example we are using MSP430 MCU, click on first option. Yous tin download more than one board files.

Click on option to download more files

Next window is to select debug probe. By default one option is available so, click on information technology and terminate. Now, your installation will starting time then but wait until it finished.

Subsequently installation, it asks near workspace folder so choose the folder where you desire to save your files and click Ok.

Choose workspace folder location to save files

So, let's take a look at the commencement window that we will see.

First window of Code Composer Studio

This is a simple interface where you can come across Getting started card in which you lot can outset to make your projection ,adjacent to getting started there is a Resource Explorer . This is a awesome feature of this software in which you can find every detail of a TI production like datasheets, documentations, etc. There is no demand to find datasheets on net, only click on resource explorer and click on the device which you lot want to explore after that you tin see every detail well-nigh the product.

Search MSP430 in Research Explorer

Creating first Projection in Code Composer Studio: Blink an LED:

Creating Project in CCS:

Step 1:- Click on File -> New -> CCS project. Every bit shown below

Select CSS project from file menu

Step ii:- Side by side, you lot have to choose MSP board that you are using. I am using MSP430G2553 then, I will choose this as shown.

Choose MSP board for New CSS project

Give proper noun to your projection and click on stop.

As shortly as you lot click on finish, a new window will open with some lines code already written into it.

Now code for your project in programming window

Writing Code in CCS:

Let's run across the structure of the code that is already given. Starting time line is our header file which depends on the variant that we choose while creating the project. As I told I am using MSP430G2553, and so I'll rename the header file to

          #include<msp430g2553.h>        

Next line is the main function. In the main role you will encounter initialization of Watchdog timer. MSP430 and other TI based microcontroller has special type of timer which is known as Watchdog timer . Piece of work of this timer is to rset the microcontroller when it starts to hanging or stop giving response. In our code, we will not utilise Watchdog timer because it is above the beginner's perspective. When we ON the Microcontroller, watchdog timer is ON past default so we take to OFF this timer by writing this line

          WDTCTL = WDTPW | WDTHOLD;        

Now, nosotros have to write code to glimmer onboard LED which is connected to P1.0. There is another LED continued to P1.6. We will use just showtime LED. Yous are able to write code for toggling these two LED'due south besides after you understand the blink plan.

First, we have to declare these PINS as we are using these equally INPUT or OUTPUT.

In that location are many type of Registers i.e. retentivity blocks used to control PORTS. And so, for defining PORT as INPUT or OUTPUT, PXDIR (X is port no.) (Data Direction Annals) register is used. If PXDIR is one it acts as OUTPUT and 0 for INPUT. Our LED is at port no. ane then we will write as P1DIR .

We need to configure Pivot 0, equally our LED is continued to this PIN and it is OUTPUT. Each port has 8 bits and we want Bit0 as HIGH to make it OUTPUT. So, we assign P1DIR as

          P1DIR = 0b00000001;          it is in binary , we tin as well write it in Hexadecimal i.e.          P1DIR = 0x01;                  

Side by side, we have to gear up the detail pin of particular port as high or low. For this purpose nosotros have to useP1OUT register, 1 for loftier while 0 for low. Initially, I brand the LED ON by setting BIT0 as 1 other remains aught.

          P1OUT=0b00000001;          P1OUT = 0x01; //in hexadecimal

As at that place is no inbuilt function of delay in MSP430 so, we have to use for loop to provide delay.

So, in adjacent step, we have to declare a variable'i'for filibuster purpose which can be written every bit

          Unsigned int i;        

Get-go, nosotros volition brand PIN0 Loftier and give some delay using FOR loop later that make the Pin LOW. In this fashion, nosotros get blinking upshot. We write program like this:

          P1OUT=0X01;   //make bit0 Loftier          for(i=0;i<20000;i++){   //    delay till you make LED HIGH     }         P1OUT=0X00;   //make bit0 Depression          for(i=0;i<20000;i++){   // delay till you lot brand LED LOW                }

You can write this code in another way also. Yous can employ BITWISE operator to reduce lines of code. There are OR, AND and XOR bitwise operators bachelor. You tin can utilize XOR operator (^) . XOR operation gives i when both bits are equal like 1 and i, 0 and 0 .We write it similar this

          P1OUT ^= 0x01;        

which means P1OUT = P1OUT xor 0b00000001;

So, initially we initialize P1OUT as 0b00000001, if nosotros have xor operation with 0b00000001, output volition exist 0b00000000 means our LED will exist OFF. After this nosotros put for loop for delay purpose.

          while(one)     {         P1OUT ^=0X01;   //toggle the bits          for(i=0;i<20000;i++){   // delay till you make LED LOW Loftier        }     }

Upload the code into MSP430:

Complete programme for CCS is given at the stop of the page. And so our code is ready to fire in MSP430. And so, connect MSP with your laptop using USB cable.

Now, we have to compile/build our code, for this click on Project -> Build All. Check the report of compilation in the console box at the bottom of the window. It will testify "Build Finished".

It's fourth dimension to upload the program. Click on Run -> Debug . Later clicking on debug, y'all will go a window related to power saving, simply click on proceed. In debug pick get to Run->Resume. If your options are blanked out, no need to worry, go to View->Debug and then again get to Run->Resume .

Equally before long every bit you debugged the code, your program is uploaded in the MSP. A shortcut way is to simply click the play/pause like button on the screen. The debug screen will wait like, equally given below

Upload the code into MSP430

If LED is not blinking then Reset the board or connect the USB once again.

And so this is how you can write a simple program in Code Composer Studio to glimmer a LED using MSP430.

Code

#include <msp430g2553.h>  // header file that depends upon your board

/*
* master.c
*/
int main(void) {
WDTCTL = WDTPW | WDTHOLD;// Stop watchdog timer
P1DIR = 0X01;    //Declare PIN0 OF PORT 1 AS OUTPUT
P1OUT = 0X01; //MAKE PIN0 High INITIALLY
unsigned int i;   //Delay variable
while(1)
{
P1OUT ^=0X01;   ////toggle the bits
for(i=0;i<20000;i++){   // delay till you lot make LED LOW Loftier
}
}
return 0;
}

ferronpues1963.blogspot.com

Source: https://circuitdigest.com/microcontroller-projects/getting-started-with-msp430-using-code-composer-studio

0 Response to "Download Code Uploaded to the Msp430 Composer Studio"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel