Jump to content

jetjaguar

Members
  • Content Count

    10
  • Joined

  • Last visited

  1. jetjaguar

    conflicting timers - using Servo.h and pitches.h

    Thank you both very much, it works now! I was able to replicate what grahamf72 suggested and the robot can now sing. I really appreciate all the help you both gave me, I believe I understand most of your explanations. Once it is done I'll post it somewhere on this forum.
  2. jetjaguar

    conflicting timers - using Servo.h and pitches.h

    Thank you for that great in depth explanation grahamf72! Whether I alter tone.cpp the way you suggest, or the way roadrunner84 suggests, or incorporating both of your changes into the file, I still get the same error as if I hadn't changed it at all. I've also tried compiling with and without the servo.cpp mod and the error is still the same. here is my servo.cpp: http://pastebin.com/vspia1et here is my tone.cpp: http://pastebin.com/VdtQV4f4 This is the sketch I am compiling (Servo.h & pitches.h are tabs in the sketch): #define SERVO_TIMER 1 #define TONE_TIMER 1 #include <Servo.h> //below is simply the toneMelody example #include "pitches.h" // notes in the melody: int melody[] = { NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4}; // note durations: 4 = quarter note, 8 = eighth note, etc.: int noteDurations[] = { 4, 8, 8, 4,4,4,4,4 }; void setup() { // iterate over the notes of the melody: for (int thisNote = 0; thisNote < 8; thisNote++) { // to calculate the note duration, take one second // divided by the note type. //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. int noteDuration = 1000/noteDurations[thisNote]; tone(8, melody[thisNote],noteDuration); // to distinguish the notes, set a minimum time between them. // the note's duration + 30% seems to work well: int pauseBetweenNotes = noteDuration * 1.30; delay(pauseBetweenNotes); // stop the tone playing: noTone(8); } } void loop() { // no need to repeat the melody. } errors: core.a(Tone.cpp.o): In function `TIMER0_A0_ISR()': C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430/Tone.cpp:208: multiple definition of `__isr_9' Servo\Servo.cpp.o:C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\libraries\Servo/Servo.cpp:108: first defined here collect2: ld returned 1 exit status
  3. jetjaguar

    conflicting timers - using Servo.h and pitches.h

    I installed Energia in a new location because I've monkeyed with my libraries so much that I don't trust them. After doing that I replaced tone.cpp with your code from post #2. Then I replaced some of the code as instructed from your post #5. Then I replaced my servo.cpp code with yours and made sure sure to add #define SERVO_TIMER 1 to the top of the sketch. Here are the new errors: C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp, -o, C:\Users\VisLab\AppData\Local\Temp\build312496893865346441.tmp\Tone.cpp.o] C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void initTimers()': C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:157:1: error: 'TA0TA0CCTL0' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:158:1: error: 'TA0TA0CCTL1' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:160:1: error: 'TA0TA0CCTL2' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void setTimer(uint8_t, unsigned int, long unsigned int)': C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:186:1: error: 'TA0TA0CCTL0' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:186:1: error: 'TA0TA0CCR0' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:187:1: error: 'TA0TA0CCTL0' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:190:1: error: 'TA0TA0CCTL1' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:190:1: error: 'TA0TA0CCR1' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:191:1: error: 'TA0TA0CCTL1' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:195:1: error: 'TA0TA0CCTL2' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:195:1: error: 'TA0TA0CCR2' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:196:1: error: 'TA0TA0CCTL2' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void stopTimer(uint8_t)': C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:207:1: error: 'TA0TA0CCTL0' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:208:1: error: 'TA0TA0CCTL1' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:210:1: error: 'TA0TA0CCTL2' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void TIMERT_A0_ISR()': C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:235:3: error: 'TA0TA0CCR0' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void TIMERT_A1_ISR()': C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:248:15: error: 'TA0TA0CCR1' was not declared in this scope C:\TiLaunchpad_startfresh\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:250:15: error: 'TA0TA0CCR2' was not declared in this scope The errors confuse me because, for example, the first one mentions "TA0TA0CCTL0" in Tone.cpp, but that doesn't exist anywhere in Tone.cpp...
  4. jetjaguar

    conflicting timers - using Servo.h and pitches.h

    Maybe I should spell out exactly what I did: I replaced my tone.cpp code with yours. Next, I added #define TONE_TIMER 1 to the top of my sketch (the same one from my opening post). That is all.
  5. jetjaguar

    conflicting timers - using Servo.h and pitches.h

    Thank you so much roadrunner84! Unfortunately I get new errors now. After I got them I noticed that you reference, but I did not have, "pins_energia.h", so I added that from here https://github.com/energia/Energia/blob/master/hardware/msp430/variants/launchpad/pins_energia.h . However I still receive errors: C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:90:26: error: 'AVAILABLE_TONE_PINS' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:90:63: error: 'SETARRAY' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:91:25: error: 'AVAILABLE_TONE_PINS' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:91:62: error: 'SETARRAY' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:92:35: error: 'AVAILABLE_TONE_PINS' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:92:70: error: 'SETARRAY' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:93:31: error: 'AVAILABLE_TONE_PINS' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:93:67: error: 'SETARRAY' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:94:29: error: 'AVAILABLE_TONE_PINS' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:94:64: error: 'SETARRAY' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void tone(uint8_t, unsigned int, long unsigned int)': C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:109:23: error: 'AVAILABLE_TONE_PINS' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:111:9: error: 'tone_pins' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:119:23: error: 'AVAILABLE_TONE_PINS' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:121:9: error: 'tone_pins' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:124:7: error: 'tone_bit' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:125:7: error: 'tone_out' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void noTone(uint8_t)': C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:143:23: error: 'AVAILABLE_TONE_PINS' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:145:9: error: 'tone_pins' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void initTimers()': C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:158:1: error: 'TA0TA0CCTL0' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:159:1: error: 'TA0TA0CCTL1' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:161:1: error: 'TA0TA0CCTL2' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void setTimer(uint8_t, unsigned int, long unsigned int)': C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:175:5: error: 'tone_interval' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:176:5: error: 'tone_periods' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:179:3: error: 'tone_interval' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:181:5: error: 'tone_periods' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:183:5: error: 'tone_periods' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:187:1: error: 'TA0TA0CCTL0' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:187:1: error: 'TA0TA0CCR0' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:188:1: error: 'TA0TA0CCTL0' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:191:1: error: 'TA0TA0CCTL1' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:191:1: error: 'TA0TA0CCR1' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:192:1: error: 'TA0TA0CCTL1' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:196:1: error: 'TA0TA0CCTL2' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:196:1: error: 'TA0TA0CCR2' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:197:1: error: 'TA0TA0CCTL2' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void stopTimer(uint8_t)': C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:208:1: error: 'TA0TA0CCTL0' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:209:1: error: 'TA0TA0CCTL1' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:211:1: error: 'TA0TA0CCTL2' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:214:4: error: 'tone_out' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:214:20: error: 'tone_bit' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void TIMERT_A0_ISR()': C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:236:3: error: 'tone_out' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:236:3: error: 'tone_bit' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:236:3: error: 'tone_periods' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:236:3: error: 'TA0TA0CCR0' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:236:3: error: 'tone_interval' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp: In function 'void TIMERT_A1_ISR()': C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:249:15: error: 'tone_out' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:249:15: error: 'tone_bit' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:249:15: error: 'tone_periods' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:249:15: error: 'TA0TA0CCR1' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:249:15: error: 'tone_interval' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:251:15: error: 'tone_out' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:251:15: error: 'tone_bit' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:251:15: error: 'tone_periods' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:251:15: error: 'TA0TA0CCR2' was not declared in this scope C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430\Tone.cpp:251:15: error: 'tone_interval' was not declared in this scope
  6. Hello everyone, I'm trying to add some sound to my robot. The Energia example sketch "toneMelody" compiles without error unless you also include the library Servo.h. I have read that Arduinos have the same problem, it is because both libraries call upon the same timer. Is it possible to change the code for one of the libraries so that it uses a different timer, if one exists, so that the libraries do not conflict? I'm still a novice at all of this so any help would be much appreciated, thank you. I am using the m430g2553 chip on the Ti Launchpad MSP430 rev.1.5 board. Energia v0101e0011. Win7. simple code: #include <Servo.h> #include "pitches.h" // notes in the melody: int melody[] = { NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4}; // note durations: 4 = quarter note, 8 = eighth note, etc.: int noteDurations[] = { 4, 8, 8, 4,4,4,4,4 }; void setup() { // iterate over the notes of the melody: for (int thisNote = 0; thisNote < 8; thisNote++) { // to calculate the note duration, take one second // divided by the note type. //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. int noteDuration = 1000/noteDurations[thisNote]; tone(8, melody[thisNote],noteDuration); // to distinguish the notes, set a minimum time between them. // the note's duration + 30% seems to work well: int pauseBetweenNotes = noteDuration * 1.30; delay(pauseBetweenNotes); // stop the tone playing: noTone(8); } } void loop() { // no need to repeat the melody. } Error message when code is compiled: core.a(Tone - Copy.cpp.o): In function `TIMER0_A0_ISR()': C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\cores\msp430/Tone - Copy.cpp:208: multiple definition of `__isr_9' Servo\Servo.cpp.o:C:\TiLaunchpad\energia-0101E0011-windows\energia-0101E0011\hardware\msp430\libraries\Servo/Servo.cpp:89: first defined here collect2: ld returned 1 exit status
  7. jetjaguar

    Ti Launchpad + Energia = Error 4

    I did. I tried another and it work just fine, so I must have damaged the first launchpad... Thank you everyone!
  8. jetjaguar

    Ti Launchpad + Energia = Error 4

    No USB hubs. Only one Launchpad plugged in, no other boards. Device manager only shows "MSP430 Application UART" under COM ports. No mention of "virtual" or FET. However, I do remember seeing FET430UIF in the device manager of my other computer (#1), which is at work. I took off all of the jumpers and put them back. No change. 3.53v is going to the VCC pin.
  9. jetjaguar

    Ti Launchpad + Energia = Error 4

    Thank you both for your quick responses! The board came with the chip on it, I have not removed it. Yes, I used Energia's drivers for comp 2. I switched out the chip with the 2452, changed the board in the program, uploaded blink, but got the same error=4 message. Maybe I did somehow damage something. I'll be able to try another launchpad on Monday...
  10. Hello everyone! I'd like some help getting my new ti Launchpad working with Energia... part: MSP430G2, chip M430G2553 All I've done to it so far is replace the pins with female headers. Now I'm trying to upload the example blink code and all I ever get is this: Binary sketch size: 677 bytes (of a 16,384 byte maximum) tilib: MSP430_OpenDevice: Could not find device (or device not supported) (error = 4) tilib: device initialization failed On computer #1 (win7, 64bit) I first installed CCS, then Energia. When I plug in the launchpad the green and red lights blink. When I try to upload using the 2553 board selection, I get the error above. I've tried all of the other board selections as well. On computer #2 (win7, 64bit) I installed the MSP-EXP430G2 64bit win7 driver from Energia's website. Then I installed Energia, tried uploading Blink and got the same errors. It's like I'm missing some crucial step... Any suggestions? Thank you very much in advance.
×