MSP430: Difference between revisions

From base48
imported>Rmarko
(Add user guide)
imported>Rmarko
(Moar links)
Line 7: Line 7:
==== SPI Interface (USCI) ====
==== SPI Interface (USCI) ====
* http://fortytwoandnow.blogspot.ch/2012/07/msp430g2-usci-spi-interface-1.html
* http://fortytwoandnow.blogspot.ch/2012/07/msp430g2-usci-spi-interface-1.html
==== Code Examples ====
==== Code Examples ====
* http://svn.noccy.com/mspdev/reference/MSP430ware/examples/devices/2xx/MSP430G2xx3%20Code%20Examples/C/
* http://svn.noccy.com/mspdev/reference/MSP430ware/examples/devices/2xx/MSP430G2xx3%20Code%20Examples/C/


==== Datasheet ====
==== Datasheets ====
http://www.ti.com/lit/ds/symlink/msp430g2553.pdf
* [http://www.ti.com/lit/ds/symlink/msp430g2553.pdf MSP430G2553]


==== TI Guides ====
* [http://www.ti.com/lit/ug/slau144i/slau144i.pdf MSP430x2xx Family User's Guide]
* [http://www.ti.com/lit/ug/slau144i/slau144i.pdf MSP430x2xx Family User's Guide]
* [http://www.ti.com/lit/an/slaa330/slaa330.pdf Software I2C Slave Using the MSP430]
==== Projects ====
* [http://www.simpleavr.com/msp430-projects/rtc-clock RTC clock]


=== Code Examples ===
=== Code Examples ===

Revision as of 14:29, 17 October 2012

MSP430G2 Launchpad

Some links

Tutorials

SPI Interface (USCI)

Code Examples

Datasheets

TI Guides

Projects

Code Examples

Timer and Button Interrupts

Blinking LED swaps on Button click. Implemented using interrupts

#include <msp430g2553.h>

__attribute__((interrupt(TIMER0_A0_VECTOR)))
void CCR0_ISR(void) {
    P1OUT ^= BIT6 | BIT0;
}

__attribute__((interrupt(PORT1_VECTOR)))
void BtnClick(void) {
    if( P1IFG & BIT3 ) {
        P1IFG &= ~BIT3;

        P1DIR ^= BIT6|BIT0;
    }
}

main()
{
    WDTCTL = WDTPW + WDTHOLD;

    TACCR0 = 62500 - 1;
    TACCTL0 = CCIE;
    TACTL = TASSEL_2 + ID_3 + MC_1 + TACLR;
    P1REN = BIT3;
    P1DIR = BIT6;
    P1OUT = BIT6|BIT3;
    P1IES |= BIT3;
    P1IFG &= ~BIT3;
    P1IE |= BIT3;

    __enable_interrupt();

    for(;;);
}