Jump to content

artifus

Members
  • Content Count

    40
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    artifus reacted to RobG in TI MSP430 Family Eagle library   
    I was little annoyed by the existing MSP430 libraries so I decided to modify them and create my own.
    Here's my first version of it. Let me know what you think.

    Updated May 7 2012
    Added 2210 & 2230

    Updated May 16 2012
    Added FR5739 (TSSOP 38)

    Updated June 20 2012
    Fixed two 14 pin devices. Pin 8 was assigned to pin 10 and vice versa.
    Affected devices: MSP430G2X31-14PW14 and MSP430G2X21-14PW14
     
    Updated March 26 2013
    Added:
    G2x55 TSSOP 38 DA
    G2x44 TSSOP 38 DA
    G2x44 PDIP 40 N

     
     
    ti_msp430.lbr
  2. Like
    artifus got a reaction from Oscarasimov in How to connect a thermistor to my MSP430 and other ?'s   
    hello.
     
    i'm new too and there appears to be quite a steep learning curve ahead, a few new concepts to absorb and a lot of jargon to take on board. best to take it slow and steady, every journey begins with a single step, etc.
     
     
    from your link:
     
  3. Like
    artifus reacted to NatureTM in Music with only a speaker, a LP, and 30 lines of code   
    Hi everyone, it's been awhile.
     
    I just wanted to share something interesting lasershark mentioned on my blog awhile ago.  It's basically a way to make music with one line of code.  It took about 15 minutes to implement on a g2553 and only requires a launchpad and a speaker.  I found it pretty entertaining.  Just connect one terminal of the speaker to Port 1.2 and the other to ground, or drive it with a transistor.
     
    Original project @ http://canonical.org/~kragen/bytebeat/
     
    #include "msp430g2553.h" #define MCLK 8000000 #define OUTPUT_SAMPLES_PER_SECOND 8000 #define PIN_SPEAKER BIT2 unsigned long t = 0; unsigned char sample; void main(void) { WDTCTL = WDTPW + WDTHOLD; DCOCTL = CALDCO_8MHZ; BCSCTL1 = CALBC1_8MHZ; P1SEL |= PIN_SPEAKER; P1DIR |= PIN_SPEAKER; TA0CTL = TASSEL_2 | MC_1; TA0CCR0 = (0x0001 << 8) - 1; TA0CCTL1 |= OUTMOD_7; TA1CTL = TASSEL_2 | MC_1; TA1CCR0 = MCLK / OUTPUT_SAMPLES_PER_SECOND - 1; TA1CCTL0 |= CCIE; _enable_interrupts(); while(1){ sample = ((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7; // sample = t*(((t>>12)|(t>>8))&(63&(t>>4))); // sample = (t*(t>>5|t>>8))>>(t>>16); // sample = t*(((t>>9)|(t>>13))&(25&(t>>6))); // sample = t*(((t>>11)&(t>>8))&(123&(t>>3))); // sample = (t*5&t>>7)|(t*3&t>>10); // sample = (t&t%255)-(t*3&t>>13&t>>6); // sample = t>>4|t&((t>>5)/(t>>7-(t>>15)&-t>>7-(t>>15))); // sample = (t*9&t>>4|t*5&t>>7|t*3&t/1024)-1; // sample = ((t*(t>>12)&(201*t/100)&(199*t/100))&(t*(t>>14)&(t*301/100)&(t*399/100)))+((t*(t>>16)&(t*202/100)&(t*198/100))-(t*(t>>17)&(t*302/100)&(t*298/100))); // sample = t*(t^t+(t>>15|1)^(t-1280^t)>>10); // sample = t&t>>8; //44 khz // sample = ((t/2*(15&(0x234568a0>>(t>>8&28))))|t/2>>(t>>11)^t>>12)+(t/16&t&24); // sample = ((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127); t++; LPM0; } } #pragma vector = TIMER1_A0_VECTOR __interrupt void T1A0_ISR(void) { TA0CCR1 = sample; LPM0_EXIT; }  
    Switch which "sample =" line is uncommented to change the "song."  The songs are from http://pelulamu.net/countercomplex/music_formula_collection.txt and there are more in that file.
     
     
  4. Like
    artifus reacted to cde in Simple Midi player, and other french tutorials   
    Found a french blog with a launchpad (and Energia) flavor to it.
     
    A couple of different write ups, from simple button tutorials to adc and lcd, as well as motor control.
    Google Translate works well enough for english.
    French: http://electroniquea...label/Launchpad
    Translated: http://translate.goo...-KjLMthQ65c63Vw
     
    Most interesting one I saw was a simple little midi project. Plays F
  5. Like
    artifus reacted to larryfraz in 2-osc PWM Midi Synth   
    Link should be fixed now ...I seem to have had better luck from my DAW than the kbd...
  6. Like
    artifus reacted to larryfraz in 2-osc PWM Midi Synth   
    I put together a 2 oscillator PWM MIDI synthesizer based on NatureTM's (thanks!) 'simple synth'. No DAC is needed. The second oscillator can be detuned and has a blend control, both accessed via midi cc's. A clip of it, and the code, are on my site at the perspectivesound blog. I haven't added adsr, I may add some more features soon.
  7. Like
    artifus got a reaction from larryfraz in 2-osc PWM Midi Synth   
    nice work! will be keeping an eye on this one. had a play with naturetm's simple synth a while ago - much fun. http://naturetm.com/?p=111
     
    you mention stuck notes on your blog - i had some midi communication problems when i added an opto isolator, no problems at all without it, but also wanted to stick to midi spec: http://www.midi.org/...electrispec.php which is kinda vague, not for 3.3v and i couldn't source a 6n138 or pc900 so only had a 4n35 available. once i added the opto i had all sorts of problems, erratic response, stuck notes, etc. requiring frequent resets.
     
    i fiddled with resistor values on the msp side which improved it somewhat but with still the occasional glitch. adding an led on the midi side has cured it with flawless response and no stuck notes but i've no idea as to why - if anyone can explain it would be appreciated. i had been using the led to check for midi output as here: http://www.alfors.co...estKonektor.jpg and here: http://www.epanorama...s/miditest.html due to an intermittent fault in my midi cable and stumbled upon this 'solution' by accident.
     
    anyways, here's what i ended up with (note that the 1k resistor should be 1k47):
     

     
    i used two resistors, 1k and 47ohms in series, on the msp side. might be worth playing with. i look forward to trying out your code.
     
    other links i stumbled upon when trouble shooting:
     
    http://blog.gg8.se/w..._side_of_things
    http://www.gammon.co...connections.png
  8. Like
    artifus got a reaction from GeekDoc in microphone input   
    stumbled upon and bookmarked this a while ago: http://www.tau.ac.il/~stoledo/lego/msp430-perfect-pitch/
     
    it listens for and detects just one specific frequency. may be of interest.
  9. Like
    artifus got a reaction from abecedarian in Fritzing for LaunchPad   
    http://www.43oh.com/2011/07/launchpad-svg-for-fritzing/
     
    http://code.google.com/p/fritzing/issues/detail?id=875#c143
  10. Like
    artifus got a reaction from dacoffey in Fritzing for LaunchPad   
    http://www.43oh.com/2011/07/launchpad-svg-for-fritzing/
     
    http://code.google.com/p/fritzing/issues/detail?id=875#c143
  11. Like
    artifus got a reaction from bluehash in Fritzing for LaunchPad   
    http://www.43oh.com/2011/07/launchpad-svg-for-fritzing/
     
    http://code.google.com/p/fritzing/issues/detail?id=875#c143
  12. Like
    artifus reacted to gordon in Efficient micro mathematics   
    Tripped over this by accident while watching one of Travis Goodspeed's talks:
     
    Efficient Micro Mathematics
  13. Like
    artifus got a reaction from GeekDoc in how goldfish invented computer programming   
    apologies if this is unavailable outside the uk - i'm sure you can find a way if so...
     
    silly sketch in a half hour show - jump to 17:30 - 21:45 ish...
     
    http://www.bbc.co.uk/iplayer/episode/b01n1rpw/John_Finnemores_Souvenir_Programme_Series_2_Episode_4/
     
    made me do a giggle.
  14. Like
    artifus got a reaction from bluehash in how goldfish invented computer programming   
    apologies if this is unavailable outside the uk - i'm sure you can find a way if so...
     
    silly sketch in a half hour show - jump to 17:30 - 21:45 ish...
     
    http://www.bbc.co.uk/iplayer/episode/b01n1rpw/John_Finnemores_Souvenir_Programme_Series_2_Episode_4/
     
    made me do a giggle.
  15. Like
    artifus got a reaction from bluehash in simple tap tempo   
    /* Based on tap tempo code found here: http://umlautllama.com/projects/arduino/s/TapTempo.pde Ported to msp430g2231 launchpad rev1.4 with energia september 2012 Use pinMode(5, INPUT_PULLUP) for rev1.5 */ void setup() { pinMode( 5, INPUT ); /* tap button - - press three times to set the tempo */ pinMode( 14, OUTPUT ); /* button state display led - low on button push */ pinMode( 2, OUTPUT ); /* tempo display led - shows the current tempo */ pinMode( 3, OUTPUT ); /* tempo display led inverted - led to gnd from pin 3 */ } int lastTapState = LOW; /* the last tap button state */ unsigned long currentTimer[2] = { 500, 500 }; /* array of most recent tap counts */ unsigned long timeoutTime = 0; /* this is when the timer will trigger next */ unsigned long indicatorTimeout; /* for our fancy "blink" tempo indicator */ void loop() { /* read the button on pin 5, and only pay attention to the HIGH-LOW transition so that we only register when the button is first pressed down */ int tapState = digitalRead( 5 ); if( tapState == LOW && tapState != lastTapState ) { tap(); /* we got a HIGH-LOW transition, call our tap() function */ } lastTapState = tapState; /* keep track of the state */ /* check for timer timeout */ if( millis() >= timeoutTime ) { /* timeout happened. clock tick! */ indicatorTimeout = millis() + ((currentTimer[0] + currentTimer[1])/2)/2; /* this sets the time when LED 14 goes off */ /* and reschedule the timer to keep the pace */ rescheduleTimer(); } /* display the button state on LED 2 */ digitalWrite( 14, tapState ); /* display the tempo on LED 1 and inverse on pin 3 */ if( millis() < indicatorTimeout ) { digitalWrite( 2, HIGH ); digitalWrite( 3, LOW ); } else { digitalWrite( 2, LOW ); digitalWrite( 3, HIGH ); } } unsigned long lastTap = 0; /* when the last tap happened */ void tap() { /* we keep two of these around to average together later */ currentTimer[1] = currentTimer[0]; currentTimer[0] = millis() - lastTap; lastTap = millis(); timeoutTime = 0; /* force the trigger to happen immediately - sync and blink! */ } void rescheduleTimer() { /* set the timer to go off again when the time reaches the timeout. The timeout is all of the "currentTimer" values averaged together, then added onto the current time. When that time has been reached, the next tick will happen... */ timeoutTime = millis() + ((currentTimer[0] + currentTimer[1])/2); }
  16. Like
    artifus reacted to xpg in Eclipse plugin for mspdebug and msp430-gcc   
    I finally managed to get time to make a new release of the MSP430Eclipse plugin. As previously, it is available from http://eclipse.xpg.dk via the Eclipse "install new software" dialog. There are two major changes in this version:
    First, mspdebug can now be configured such that other drivers than the rf2500 can be used. I have not tested this, as I only have a launchpad. Hopefully someone from this forum is willing to give it a spin, and let me know if it works or not.
    The second improvement is with regards to debugging. It's now much simpler to configure the debugger, and the code behind is much cleaner.
     
    I've recorded a small video to show how msp430eclipse is installed, and how it can be used to create, upload, and debug a small program:


     
    Enjoy.
  17. Like
    artifus got a reaction from jsolarski-backup in simple tap tempo   
    /* Based on tap tempo code found here: http://umlautllama.com/projects/arduino/s/TapTempo.pde Ported to msp430g2231 launchpad rev1.4 with energia september 2012 Use pinMode(5, INPUT_PULLUP) for rev1.5 */ void setup() { pinMode( 5, INPUT ); /* tap button - - press three times to set the tempo */ pinMode( 14, OUTPUT ); /* button state display led - low on button push */ pinMode( 2, OUTPUT ); /* tempo display led - shows the current tempo */ pinMode( 3, OUTPUT ); /* tempo display led inverted - led to gnd from pin 3 */ } int lastTapState = LOW; /* the last tap button state */ unsigned long currentTimer[2] = { 500, 500 }; /* array of most recent tap counts */ unsigned long timeoutTime = 0; /* this is when the timer will trigger next */ unsigned long indicatorTimeout; /* for our fancy "blink" tempo indicator */ void loop() { /* read the button on pin 5, and only pay attention to the HIGH-LOW transition so that we only register when the button is first pressed down */ int tapState = digitalRead( 5 ); if( tapState == LOW && tapState != lastTapState ) { tap(); /* we got a HIGH-LOW transition, call our tap() function */ } lastTapState = tapState; /* keep track of the state */ /* check for timer timeout */ if( millis() >= timeoutTime ) { /* timeout happened. clock tick! */ indicatorTimeout = millis() + ((currentTimer[0] + currentTimer[1])/2)/2; /* this sets the time when LED 14 goes off */ /* and reschedule the timer to keep the pace */ rescheduleTimer(); } /* display the button state on LED 2 */ digitalWrite( 14, tapState ); /* display the tempo on LED 1 and inverse on pin 3 */ if( millis() < indicatorTimeout ) { digitalWrite( 2, HIGH ); digitalWrite( 3, LOW ); } else { digitalWrite( 2, LOW ); digitalWrite( 3, HIGH ); } } unsigned long lastTap = 0; /* when the last tap happened */ void tap() { /* we keep two of these around to average together later */ currentTimer[1] = currentTimer[0]; currentTimer[0] = millis() - lastTap; lastTap = millis(); timeoutTime = 0; /* force the trigger to happen immediately - sync and blink! */ } void rescheduleTimer() { /* set the timer to go off again when the time reaches the timeout. The timeout is all of the "currentTimer" values averaged together, then added onto the current time. When that time has been reached, the next tick will happen... */ timeoutTime = millis() + ((currentTimer[0] + currentTimer[1])/2); }
  18. Like
    artifus reacted to xpg in Eclipse plugin for mspdebug and msp430-gcc   
    Hi guys,

    I've finally hacked together a plugin for Eclipse that allows the msp430-gcc toolchain to be used from within Eclipse more easily.
    I must warn you that this is by no means finished, but I wanted to get it out there to get some opinions before I spend too much time on it.

    Features and Limitations:

    - Supports msp430-gcc macro and include directory discovery (though msp430-gcc must be in your PATH).
    - Extracts list of supportet MCUs from msp430-gcc, and allows target MCU to be easily selected and changed.
    - Use mspdebug to upload to target (only Launchpad is supported and the device is autodetected).
    - Only Linux and Windows are supported at this point.
    - Binary toolchains are provided for Linux and Windows, in order to ease installation.

    Changelog:
    1.0.5.1

    -Added Windows support.
    -Added dependency on "Target Management Terminal".
    -Add .cpp as C++ extension.
    -Support for FRAM board (by using a newer version of mspdebug).
    -Fix a bug: mspdebug fails to startup successfully for debugging session.
    -Group MCU List to make selection easier.
    -Remove usage of stdbuf.
    -Simplify tool selection by adding an "Activate"-button to the tool manager.
    -Add support for static libraries (project type).
    -Kill mspdebug when debugger is stopped.
    -"tilib" to the mspdebug driver selection.
     
    1.0.4.1
    -gcc, gdb, and mspdebug are no longer distributed as an eclipse plugin, but as a separate download package. This allows the tools to be installed in a user select location, rather than trying to install into the eclipse directory.
    -MSP430 C/C++ projects can now be created.
    -The protocol (SBW, JTAG) used by MSPDebug can now be selected.
     
    Installation:
    Add http://eclipse.xpg.dk as a software source in Eclipse, and install the Msp430Eclipse plugin.
    Currently, only Indigo is supported, but the plugin might work with Helios and Juno as well.

    If your system does not have up-to-date version of msp430-gcc, msp430-gdb, and mspdebug, you can download one of the following tool-packages:

    Linux 64-bit: msp430-toolchain-linux-amd64-3.0.tar.bz2
    Linux 32-bit: msp430-toolchain-linux-i386-2.1.tar.bz2
    Windows 32-bit: msp430-toolchain-win-x86-3.0.zip
    Mac OS X: msp430-toolchain-mac_os_x-x86_64-2.2.tar.bz2

    Extract the package in an appropriate location ($HOME, for instance), and go to Eclipse (with the MSP430Eclipse plugin installed), and from the menu select MSP430->Tool Manager. Click the "Add..."-button, and browse to the tool-package directory. Select the tool-chain and press the "Activate"-button in order to tell Eclipse to use it.

    You can verify that the right tool-package is used by going to the Eclipse preference and select "MSP430". Here you will be able to see and choose what tools are used from which package.

    For windows, you will need to install USB-drivers as described in the MSPDebug FAQ.

    Getting Started:
    In order to use the MSP430 features, you have to create a new C project and choose "Empty Project" from the "MSP430 Cross Target Application" group. It is possible to select the target MCU from the wizard, but this does currently not work.

    After having created the project, right click on it and select properties. In the "MSP430"-setting it is possible to select the target MCU. Remember to press "Apply" in order for the selection to take effect.

    After having added some source files and compiled the project, you can upload it to the MSP430 by choosing the MSP430-menu, and selecting the "Upload to target action"

    Using the Debugger
    In order to debug your program, go to the "Debug Configuration"-dialog, and create a new configuration in the "MPS430 Debug"-group (by right-clicking it). Having that new configurations elected, simply click "Debug".
     
    For people interested in hacking on the source code of msp430Eclipse, it is available at gitorious: https://gitorious.org/msp430eclipse
     

    Updated September 3rd: New version released (1.0.5.1), updated description
    Updated April 23rd 2013: Links to toolchains updated.
    Updated April 25th 2013: Added link to gitorious project.
  19. Like
    artifus got a reaction from SirZusa in diy resistive ribbon sensor   
    stumbled upon this recently, thought it may be of interest:
     
    http://memoir.okno.be/phys_comp_tutorial/ribbon4/ribbon4.htm
  20. Like
    artifus reacted to oPossum in 12 voice polyphonic wavetable synth with G2211   
    PWM audio output on P1.6.
     
    Uses NCO with 16 or 32 bit precision. No interpolation due to lack of hardware multiplier on G2211.
     

    ; synth.asm .cdecls C, LIST, "msp430g2211.h" smplrt .equ 38400 ; Sample rate ph32 .equ 0 ; Use 32 bit phase .text .global set_tick .global get_tick .global synth_init .global set_note .bss tick, 2 .if ph32 .bss phase_inc, 4 * 12 ; Phase increment LSW/MSW (from note table) .bss phase_acc, 4 * 12 ; Phase accumulator LSW/MSW .else .bss phase_inc, 2 * 12 ; Phase increment (from note table) .bss phase_acc, 2 * 12 ; Phase accumulator .endif set_tick mov R12, &tick ret get_tick mov &tick, R12 ret synth_init mov #0x0210, &TACTL ; Timer A config: SMCLK, count up ;mov #511, &TACCR0 ; Setup Timer A period for 31250 sps mov #415, &TACCR0 ; Setup Timer A period for 38400 sps mov #256, &TACCR1 ; Setup Timer A compare mov #0x00E0, &TACCTL1 ; Setup Timer A reset/set output mode ; mov #phase_inc, R12 ; Clear all phase inc and accum .if ph32 ; mov #4 * 12, R14 ; Word count .else ; mov #2 * 12, R14 ; Word count .endif ; clr 0(R12) ; Clear word incd R12 ; Next word dec R14 ; Dec word count jne $ - 8 ; Loop until all words done... ; eint ; Enable interupts bis #0x0010, &TACCTL1 ; Enable PWM interupt ret synth_isr push R4 push R5 push R6 push R7 push R8 push R9 mov #sine, R4 ; Get wavetable pointer mov #phase_inc, R5 ; Setup phase increment pointer .if ph32 ; mov #phase_acc + 2, R6 ; Setup phase accumulator pointer .else ; mov #phase_acc, R6 ; Setup phase accumulator pointer .endif ; clr R7 ; Clear sample accumulator mov #12, R8 ; Setup voice count voice_loop ; mov @R6, R9 ; Get phase acc (MSW) swpb R9 ; Swap MSB/LSB mov.b R9, R9 ; Clear MSB add R4, R9 ; Add wavetable pointer mov.b @R9, R9 ; Get wave sample add R9, R7 ; Update sample .if ph32 ; add @R5+, -2(R6) ; Update phase acc addc @R5+, 0(R6) ; add #4, R6 ; Increment phase acc pointer .else ; add @R5+, 0(R6) ; Update phase acc incd R6 ; Increment phase acc pointer .endif ; dec R8 ; Dec voice count jne voice_loop ; Next voice... ; rra R7 ; rra R7 ; rra R7 ; add #16, R7 ; mov R7, &TACCR1 ; Output sample ; dec &tick ; jc $ + 6 ; clr &tick ; ; bic #0x01, &TACCTL1 ; ; pop R9 pop R8 pop R7 pop R6 pop R5 pop R4 reti set_note clr R14 ; Clear octave count cmp #128, R12 ; jhs note_off ; tst_note ; cmp #116, R12 ; Within note table? jge get_pi ; Yes... inc R14 ; Inc octave count add #12, R12 ; Add octave to note jmp tst_note ; Check again... get_pi ; Get phase increment sub #116, R12 ; Adjust for first note in table rla R12 ; MIDI note * 2 .if ph32 ; rla R12 ; MIDI note * 2 (* 4 total) add #notes, R12 ; Add note table pointer mov @R12+, R15 ; Get LSW .else ; add #notes, R12 ; Add note table pointer .endif ; mov @R12, R12 ; Get MSW tst R14 ; Shifting required? jeq set_phase ; No... shift_phase ; rra R12 ; Shift phase inc .if ph32 ; rrc R15 ; .endif ; dec R14 ; Dec octave count jne shift_phase ; Repeat until zero... set_phase ; rla R13 ; Voice * 2 .if ph32 ; rla R13 ; Voice * 2 (* 4 total) add #phase_inc, R13 ; Add phase inc pointer mov R15, 0(R13) ; Set phase inc mov R12, 2(R13) ; .else ; add #phase_inc, R13 ; Add phase inc pointer mov R12, 0(R13) ; Set phase inc .endif ; ret ; Return ; note_off ; rla R13 ; Voice * 2 .if ph32 ; rla R13 ; Voice * 2 (* 4 total) .endif ; mov R13, R12 ; Copy add #phase_inc, R12 ; Phase inc pointer add #phase_acc, R13 ; Phase accum pointer clr 0(R12) ; Clear phase inc clr 0(R13) ; Clear phase accum .if ph32 ; clr 2(R12) ; clr 2(R13) ; .endif ; ret ; Return ; ; notes ; MIDI Note Frequency .if smplrt == 31250 ; 31250 sps .if ph32 ; .long 913264688 ; 116 G#8 6644.875 .long 967570232 ; 117 A8 7040.000 .long 1025104952 ; 118 A#8 7458.620 .long 1086060865 ; 119 B8 7902.133 .long 1150641405 ; 120 C9 8372.018 .long 1219062103 ; 121 C#9 8869.844 .long 1291551308 ; 122 D9 9397.273 .long 1368350945 ; 123 D#9 9956.063 .long 1449717327 ; 124 E9 10548.082 .long 1535922005 ; 125 F9 11175.303 .long 1627252680 ; 126 F#9 11839.822 .long 1724014160 ; 127 G9 12543.854 .else ; .word 13935 ; 116 G#8 6644.726 .word 14764 ; 117 A8 7040.024 .word 15642 ; 118 A#8 7458.687 .word 16572 ; 119 B8 7902.145 .word 17557 ; 120 C9 8371.830 .word 18601 ; 121 C#9 8869.648 .word 19708 ; 122 D9 9397.507 .word 20879 ; 123 D#9 9955.883 .word 22121 ; 124 E9 10548.115 .word 23436 ; 125 F9 11175.156 .word 24830 ; 126 F#9 11839.867 .word 26306 ; 127 G9 12543.678 .endif ; .endif ; ; .if smplrt == 38400 ; 38400 sps .if ph32 ; .word 743216706 ; 116 G#8 6644.875 .word 787410671 ; 117 A8 7040.000 .word 834232546 ; 118 A#8 7458.620 .word 883838595 ; 119 B8 7902.133 .word 936394372 ; 120 C9 8372.018 .word 992075279 ; 121 C#9 8869.844 .word 1051067145 ; 122 D9 9397.273 .word 1113566850 ; 123 D#9 9956.063 .word 1179782981 ; 124 E9 10548.082 .word 1249936527 ; 125 F9 11175.303 .word 1324261621 ; 126 F#9 11839.822 .word 1403006315 ; 127 G9 12543.854 .else ; .word 11341 ; 116 G#8 6645.117 .word 12015 ; 117 A8 7040.039 .word 12729 ; 118 A#8 7458.398 .word 13486 ; 119 B8 7901.953 .word 14288 ; 120 C9 8371.875 .word 15138 ; 121 C#9 8869.922 .word 16038 ; 122 D9 9397.266 .word 16992 ; 123 D#9 9956.250 .word 18002 ; 124 E9 10548.047 .word 19073 ; 125 F9 11175.586 .word 20207 ; 126 F#9 11840.039 .word 21408 ; 127 G9 12543.750 .endif ; .endif ; sine .byte 128 .byte 131 .byte 134 .byte 137 .byte 140 .byte 144 .byte 147 .byte 150 .byte 153 .byte 156 .byte 159 .byte 162 .byte 165 .byte 168 .byte 171 .byte 174 .byte 177 .byte 179 .byte 182 .byte 185 .byte 188 .byte 191 .byte 193 .byte 196 .byte 199 .byte 201 .byte 204 .byte 206 .byte 209 .byte 211 .byte 213 .byte 216 .byte 218 .byte 220 .byte 222 .byte 224 .byte 226 .byte 228 .byte 230 .byte 232 .byte 234 .byte 235 .byte 237 .byte 239 .byte 240 .byte 241 .byte 243 .byte 244 .byte 245 .byte 246 .byte 248 .byte 249 .byte 250 .byte 250 .byte 251 .byte 252 .byte 253 .byte 253 .byte 254 .byte 254 .byte 254 .byte 255 .byte 255 .byte 255 .byte 255 .byte 255 .byte 255 .byte 255 .byte 254 .byte 254 .byte 254 .byte 253 .byte 253 .byte 252 .byte 251 .byte 250 .byte 250 .byte 249 .byte 248 .byte 246 .byte 245 .byte 244 .byte 243 .byte 241 .byte 240 .byte 239 .byte 237 .byte 235 .byte 234 .byte 232 .byte 230 .byte 228 .byte 226 .byte 224 .byte 222 .byte 220 .byte 218 .byte 216 .byte 213 .byte 211 .byte 209 .byte 206 .byte 204 .byte 201 .byte 199 .byte 196 .byte 193 .byte 191 .byte 188 .byte 185 .byte 182 .byte 179 .byte 177 .byte 174 .byte 171 .byte 168 .byte 165 .byte 162 .byte 159 .byte 156 .byte 153 .byte 150 .byte 147 .byte 144 .byte 140 .byte 137 .byte 134 .byte 131 .byte 128 .byte 125 .byte 122 .byte 119 .byte 116 .byte 112 .byte 109 .byte 106 .byte 103 .byte 100 .byte 97 .byte 94 .byte 91 .byte 88 .byte 85 .byte 82 .byte 79 .byte 77 .byte 74 .byte 71 .byte 68 .byte 65 .byte 63 .byte 60 .byte 57 .byte 55 .byte 52 .byte 50 .byte 47 .byte 45 .byte 43 .byte 40 .byte 38 .byte 36 .byte 34 .byte 32 .byte 30 .byte 28 .byte 26 .byte 24 .byte 22 .byte 21 .byte 19 .byte 17 .byte 16 .byte 15 .byte 13 .byte 12 .byte 11 .byte 10 .byte 8 .byte 7 .byte 6 .byte 6 .byte 5 .byte 4 .byte 3 .byte 3 .byte 2 .byte 2 .byte 2 .byte 1 .byte 1 .byte 1 .byte 1 .byte 1 .byte 1 .byte 1 .byte 2 .byte 2 .byte 2 .byte 3 .byte 3 .byte 4 .byte 5 .byte 6 .byte 6 .byte 7 .byte 8 .byte 10 .byte 11 .byte 12 .byte 13 .byte 15 .byte 16 .byte 17 .byte 19 .byte 21 .byte 22 .byte 24 .byte 26 .byte 28 .byte 30 .byte 32 .byte 34 .byte 36 .byte 38 .byte 40 .byte 43 .byte 45 .byte 47 .byte 50 .byte 52 .byte 55 .byte 57 .byte 60 .byte 63 .byte 65 .byte 68 .byte 71 .byte 74 .byte 77 .byte 79 .byte 82 .byte 85 .byte 88 .byte 91 .byte 94 .byte 97 .byte 100 .byte 103 .byte 106 .byte 109 .byte 112 .byte 116 .byte 119 .byte 122 .byte 125 ; Interrupt Vectors .sect ".int08" ; TACCR1 CCIFG, TAIFG .short synth_isr ; ; .end ;
     
    Some code to test it...

    // main.c #include "msp430g2211.h" void set_tick(unsigned); unsigned get_tick(void); void synth_init(); void set_note(int, unsigned); void main(void) { unsigned n; WDTCTL = WDTPW + WDTHOLD; BCSCTL1 = XT2OFF + 15; P1DIR = 0xF2; // I/O assignment P1REN = 0x0D; // Pull up resistor for switch and Rxd P1OUT = 0x0F; // Pull up, serial idle high P1SEL = 0x50; // Enable Timer A output, SMCLK output synth_init(); #if 0 set_note(33, 0); // A1 55 Hz set_note(45, 1); // A2 110 Hz set_note(57, 2); // A3 220 Hz set_note(69, 3); // A4 440 Hz set_note(81, 4); // A5 880 Hz set_note(93, 5); // A6 1760 Hz set_note(105, 6); // A7 3520 Hz set_note(117, 7); // A8 7040 Hz #endif #if 0 set_note(69, 0); // A4 440 Hz set_note(70, 1); // set_note(71, 2); // set_note(72, 3); // set_note(73, 4); // set_note(74, 5); // set_note(75, 6); // set_note(76, 7); // set_note(77, 8); // set_note(78, 9); // set_note(79, 10); // set_note(80, 11); // #endif #if 1 n = 57; for(; { set_note(0x7F & n++, 0); set_tick(5000); while(get_tick()); set_note(-1, 0); set_tick(1000); while(get_tick()); } #endif for(;; }
     
    Working on MIDI support so it can play music.
  21. Like
    artifus got a reaction from GeekDoc in Best information for those new to the MSP430?   
    hello fellow noobs. if your eyes are bleeding from reading but your brain is still hungry for more and you have an hour or so to kill i recently found this short series of brief youtube tutorials very easy to watch and quite helpful in getting my head around a few c programming basics, which has been useful when studying code examples.
     

  22. Like
    artifus got a reaction from bluehash in Best information for those new to the MSP430?   
    hello fellow noobs. if your eyes are bleeding from reading but your brain is still hungry for more and you have an hour or so to kill i recently found this short series of brief youtube tutorials very easy to watch and quite helpful in getting my head around a few c programming basics, which has been useful when studying code examples.
     

  23. Like
    artifus got a reaction from oPossum in Best information for those new to the MSP430?   
    hello fellow noobs. if your eyes are bleeding from reading but your brain is still hungry for more and you have an hour or so to kill i recently found this short series of brief youtube tutorials very easy to watch and quite helpful in getting my head around a few c programming basics, which has been useful when studying code examples.
     

  24. Like
    artifus got a reaction from cubeberg in Best information for those new to the MSP430?   
    hello fellow noobs. if your eyes are bleeding from reading but your brain is still hungry for more and you have an hour or so to kill i recently found this short series of brief youtube tutorials very easy to watch and quite helpful in getting my head around a few c programming basics, which has been useful when studying code examples.
     

  25. Like
    artifus reacted to SirPatrick in porting pic and avr to msp430   
    Definitely agree with JWoordrell. C is actually a really small and concise language as far as built in features go. Most of the "porting" will be in setting up the particular MCU's peripherals (clocks, ADCs,etc). Each architecture has very detailed data sheets on setting up the different peripherals.
     
    So if you wanted to port code from an AVR Atmega328p to to MSP430 you would have to understand the periphials of each. In the AVR's case we would want to find the data sheet for this device or device family. A quick google search for "Atmega328p Datasheet"
    yields exactly what we want. Here is that datasheet in PDF form: http://www.atmel.com/Images/8271s.pdf.
     
    Next we need to find the information for the MSP430's hardware. Here is that link http://www.ti.com/lit/ug/slau144i/slau144i.pdf.
     
    So the next step would be to break up the code into portions that are standard to the C language and then those that are specific to the given architecture. When doing this make sure not to get stuck trying to translate the code line by line. If you try this a lot of times you will run into a lot of roadblocks. Instead analyze what the code is trying to accomplish and not specifically how it is doing it.
     
    Really the make or break skill here is being able to read a datasheet and not drown in what seems like the infinite amount of knowledge. For that skill I point you to these links:
    http://www.sparkfun.com/tutorials/223
    http://www.egr.msu.edu/classes/ece480/c ... asheet.pdf
     
    So good luck and make sure not to get discouraged about all the information out there. A good way to do this is to learn by having specific projects and goals in mind. This will allow you to go through topics and certain areas as you need them.
×
×
  • Create New...