In this example we will take a look at the MSP430FR4133 launchpad from Texas Instruments. There will be a blinky LED example which was written in Code Composer studio.
Lets look at the MSP430Fr133 launchpad first
The MSP-EXP430FR4133 LaunchPad development kit contains everything needed to start developing on the MSP430 Ultra-low-power FRAM-based microcontroller platform, including on-board emulation for programming, debugging and energy measurements. The board features on-board buttons and LEDs for quick integration of a simple user interface as well as a Liquid Crystal Display which showcases the integrated driver with flexible software-configurable pins. The MSP430FR4133 device features LCD support with an integrated 10-bit ADC as well as embedded FRAM, a non-volatile memory known for its ultra-low power, high endurance and high speed write access.
Features
MSP430 ULP MSP430FR4133 MCU 16KB FRAM
16-bit RISC architecture up to 8-MHz FRAM access/ 16-MHz system clock speed
3 x timer blocks
10 channel 10-bit ADC
8 x 32 segment LCD driver with integrated charge pump and configurable pins
EnergyTrace™ technology available for ultra-low-power debugging
20 pin LaunchPad standard leveraging the BoosterPack ecosystem
Onboard eZ-FET emulation
2 buttons and 2 LEDs for user interaction
Low-power alphanumeric segmented LCD
Parts List
Name | Link |
MSP430FR4133 LaunchPad development board | TI original spot MSP430FR4133 LaunchPad development board MSP-EXP430FR4133 |
Code
As stated this is a Code Composer studio example, so you will need to download that and create a new project. http://processors.wiki.ti.com/index.php/Download_CCS
In this example we will blink the LED on for 1 second and off for 1 second, here is how we will do this
The ACLK increments the peripheral around about every 25µs. Therefore, to count for 1 seconds, we would need to count like this:
1 second / 25µs = 40,000 times
The program counts to 40,000 while the red LED is on. Then, it turns off the red LED and counts to 40,000 one time before turning the red LED back on and repeating.
[codesyntax lang=”cpp”]
#include <msp430.h> #define RED_LED 0x0001 #define DEVELOPMENT 0x5A80 // Stop the watchdog timer #define ENABLE_PINS 0xFFFE // Required to use inputs and outputs #define ACLK 0x0100 // Timer_A ACLK source #define UP 0x0010 #define TAIFG 0x0001 // Timer A Interrupt flag main() { WDTCTL = DEVELOPMENT; PM5CTL0 = ENABLE_PINS; TA0CCR0 = 40000; TA0CTL = ACLK | UP; P1DIR = RED_LED; // Set red LED as an output P1OUT = RED_LED; // Turn red LED on while(1) { if(TA0CTL & TAIFG) { TA0CTL = TA0CTL & (~TAIFG); if (P1OUT & RED_LED) // If the red LED is on { P1OUT = 0x00; } else // Else, red LED is off { P1OUT = RED_LED; // Turn on the red LED } } } }
[/codesyntax]
You could either change the TA0CCR0 value to change the delay or create a simple loop and say run this 5 times which would simulate a 5 seconds delay