http://indiantinker.wordpress.com/2014/02/17/coffeebreak-tutorial-1-setting-up-ubuntu-12-04lts-64bit-to-say-hi-to-msp430
1.1. The original of this
http://www.mycontraption.com/programming-the-msp430-launchpad-on-ubuntu/
2. WISP code to test
http://wisp.wikispaces.com/
sudo apt-get install binutils-msp430 gcc-msp430 msp430-libc mspdebug
msp430-gcc
- check MSP430 installation
- msp430-gcc: no input files // you will see no input fileslsusb // check MSP430 is properly connected
mspdebug -uif //MSP430 debugger for the device
DO somecoding in main.c
+---------------------------------------------------------------------------+
/*
* main.c
*/
#include
#define LED BIT0
void delayMS(unsigned int ms ) // MS delay function
{
unsigned int i;
for (i = 0; i<= ms; i++)
__delay_cycles(2000);
}
int main(void) {
WDTCTL = WDTPW + WDTHOLD;
P1DIR |= LED;
P1OUT=0x00;
while(1)
{
P1OUT^= LED;
delayMS(500);
}
return 0;
}
+---------------------------------------------------------------------------+
msp430-gcc -Os -Wall -g -mmcu=msp430f2013 -c main.c // compile
msp430-gcc -g -mmcu=msp430f2013 -o main.elf main.o // elf (Executable and Linking file)
file generation- sudo mspdebug uif 'erase' 'load main.elf' 'exit' // burn the executable to MSP430
댓글 7개:
http://processors.wiki.ti.com/index.php/Digital_I/O_%28MSP430%29
http://mykyta.info/a/embedded/msp430/_p_g__e_x_a_m_p_l_e__b_a_s_i_c.html
http://www.msp430launchpad.com/2010/09/simple-adc-example-on-launchpad.html
//***************************************************************************************
// Tag2Tag Main function
//
// Description; Tx and Rx based on the system diagram
// P1.0 = Tx,LED
// P1.1 = Rx
// ACLK = n/a, MCLK = SMCLK = default DCO
//
// MSP430F2013
// -----------------
// /|\| XIN|-
// | | | ___
// --|RST XOUT|- \|/
// | | +----------+ |
// | P1.0|-->TX,LED -->| Switch |----+
// | P1.1|<--RX <--| |
// +-----------------+ +----------+
//
// Jihoon Ryoo
// IDciti.com
// Dec 2014
// Built with Code Composer Studio v6
//***************************************************************************************
#define GND 0x00
#define TXD 0x01 //TXD on P1.0
#define RXD 0x02 //RXD on P1.1
#define ID 0x00 // SET this device as ID0
#define DST 0x01
#include
void sleepus(int ms)
{
do ms--; // SW Delay
while(ms != 0);
}
void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
P1DIR |= TXD; // Set P1.0/P1.1 to output/input direction
for(;;) {
volatile unsigned int i; // volatile to prevent optimization
/*
if ( (P1IN &= RXD) == RXD)
{
P1OUT = TXD;
}
else
{
P1OUT = GND;
}
*/
P1OUT ^= TXD;
//sleepus(10000);
i = 10000;
do i--;
while(i != 0);
}
}
https://www.youtube.com/watch?v=2apqOiLHEzs&feature=youtu.be
https://learn.adafruit.com/downloads/pdf/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi.pdf
34.247kHz is maximum transmitting frequency
댓글 쓰기