Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by tripwire

  1. Yeah, that packs a lot into a single line! It's effectively doing this: __interrupt void isr_ccr0(void) { static unsigned s = 0; // State static unsigned d; // On duration if(s == 0) { d = pwm_on[0]; // Save "on" time, which is used later to calculate the length of the "off" half of this cycle TA1CCR0 += d; s = 1; // (0++ & 1) == (1 & 1) == 1 } else { TA1CCR0 += (pwm_period[0] - d); s = 0; // (1++ & 1) == (2 & 1) == 0 } } By the way, Katie's appnote can be used for y
  2. Ok, in that case you can use the same setup as in Doug's code, or the similar technique from the post I linked. With regard to the way the ISRs are written I think oPossum's code is a better example, as it uses the correct method to update TACCRx and also handles the interrupt flags properly in TIMERA1_VECTOR.
  3. Do you still need to add another PWM output to your program, or was 1 PWM + 1 square wave what you wanted to achieve?
  4. Was it this post, by any chance? http://forum.43oh.com/topic/5619-pwm-using-timer-output-toggle-mode/
  5. There are a couple of independent elements in your project, so I'd suggest tackling each in isolation before putting it all together. One part is the button handling: detecting the difference between a "quick push" and holding the button down. To keep things simple you could toggle one LED each time there's a quick press, and flash another LED while the button is held down. I expect you'll want to make sure that the "quick push" LED isn't toggled by the start of a long hold, or the other way round. That'll probably involve polling the button's state every so often, toggling the LED when th
  6. You need to pass __delay_cycles a number of cycles to wait for, eg "__delay_cycles(40)" will busy wait for 40 cycles. That would give a 40 microsecond delay if MCLK frequency is set to 1MHz. MSP430G2553 will default to approx 1.1MHz on startup, which is good enough for rough timing. If you need more accuracy you can use the DCO calibration constants to set it to 1MHz.
  7. You shouldn't need to set P1SEL for the button (or the LED), setting bits in PxSEL chooses the peripheral function for the corresponding pin (ie not GPIO function). Also, a small suggestion on programming style: it's better to use the __delay_cycles() intrinsic than roll-your-own delay loops. __delay_cycles() takes one parameter telling it how many MCLK cycles to wait for, and then the compiler generates code to use exactly that many cycles. It gives predicatable timing, and there's no risk of the compiler optimising it out.
  8. I just noticed that I never got around to answering this question. Sorry about that! In case anyone else finds this post in future and wants to know where the library source code lives, you should find it in: {CCS Install Folder}\ccsv6\tools\compiler\msp430_4.3.5\lib\src The "ccsv6" and "msp430_4.3.5" parts of the path might have different version numbers depending on your CCS install. If that folder doesn't exist or is empty, look in the \lib folder and there will be an rtssrc.zip that you can unpack to get the full source.
  9. The CCS forum on the E2E board is a good place to ask. Actually I just looked on there and found this: Adding a "property sheet" to code composer It looks like CCS5.3 added a new way to create templates that's less tightly coupled to the CCS version. I've only skimmed over the wiki page linked in there, but it appears that it'll be easier to use than the other project template system.
  10. Excellent bundles! It took me a while to find a suitable source for M/F jumper wires when I first got my launchpads. Everyone sells M/M ones because that's what arduino requires. Are these kits only going to be available from amazon.com, or are they getting rolled out to any amazon storefronts outside the US too?
  11. This means that the linker has failed because you're calling a function that isn't defined anywhere (ie you've given a prototype but the linker can't find the corresponding function body). The console window should show a list of the names of these undefined symbols somewhere.
  12. Do you want to change all your existing projects to output TI-TXT, or just make CCS enable that setting by default for new projects? If it's the latter you might be able to change the CCS project templates or add a new one. I worked out how to do it a couple of years ago to set up naken430util cycle count output in all my 430 projects. The tricky bit will be figuring out whether the TI_TXT output setting gets copied from the template correctly (IIRC not all settings can be taken from the templates).
  13. I'm afraid you've fallen into one of the traps set by the designers of C there. They got the precedence of the bitwise operators wrong, so that line will be evaluated as: if (P1IN & (BTN==0)) Instead of what you'd expect it to do: if ((P1IN & BTN)==0) You need to include the parentheses around P1IN & BTN to get the correct result. That doesn't explain why CCS can't find the out file, though. Take a look in the C:\Users\Jake\Google Drive\CCS\Turn lights on\Debug\ folder to see if it's there or not. If it is there maybe CCS is having trouble with spaces in the file path.
  14. That's one step in the right direction, but there are a few more things to fix before it will work. First of all you have an "if" statement with a semicolon at the end of the line. That detaches the following block {in braces} from the if, so it will always be run. It also leaves the "else" hanging out there on its own, which is why the compiler is unhappy about line 25. You need to remove those semicolons: if (BTN==0) // <- no semicolon here! { // Code here will now only be run if BTN==0 } else // <- no semicolon here! { // Code here will now only be run if BTN!=0 } Als
  15. This line in your working energia code does three things: It sets the pin to input mode, but also enables an internal resistor that pulls the pin up to VCC. In the plain C version you only have the pin set to input (which is the default), but the pullup resistor is not enabled. If you're using the P1.3 button on the MSP430G2 launchpad, for example, you'll need to set P1REN bit 3 to enable the internal resistor, and also set P1OUT bit 3 to make the internal resistor a pullup (rather than pulldown). With that done, P1IN bit 3 will be 1 when the button is not pressed, and 0 when the
  16. Also, if you really need a busy wait it's better to use the __delay_cycles() intrinsic function. That way the compiler definitely won't optimise it out and the length of the delay is clearly defined.
  17. I'm guessing you've jumpered P1.4 to P1.5 so that when P1.4 is toggled it will trigger the capture. Does the capture interrupt never fire, or does it run but not print the output, or is the printed output incorrect? It's not clear exactly where the problem lies, so I'm going to throw out some suggestions which may or may not be relevant. The condition on the line "if (P1IN & BIT5 ==1)" will never be true, as it is evaluated like so: if (P1IN & (BIT5 ==1)). BIT5 isn't equal to 1, so that becomes if (P1IN & 0), which is always false. You'll need to use parentheses to force th
  18. The site says it's a CC2531 rather than CC3200 (Intel 8051 CPU instead of ARM Cortex-M4)
  19. I just tried to send a PM and got an error saying "The member [...] cannot receive any new messages. This personal message has not been sent". That's probably because their messagebox is full or disabled. Fair enough. Anyway, I then tried to save the message to send later and got the exact same message. The message didn't save to the drafts folder. Removing the member name doesn't help either (gives a message saying it needs to be specified). I'm not sure what's going on here. Perhaps the "Save (Send later)" button is actually trying to send the message. If not then the save function i
  20. Have you tried the strtol function to see if that works (also in stdlib.h). I'm wondering if the problem is due to lack of support for "double" type.
  21. The Kreyos Smartwatch appears to contain an MSP430F5438A Source: http://www.genki.co.nz/cramp/the-kreyos-is-not-waterproof/ There's a set of teardown pics further down that page.
  22. I just noticed that the announcement is missing the pictures that explain how to upload images. Were they linked in from an external site?
  23. I expect you'd need to watch out for the thermal effects of that large voltage drop. Otherwise you might be inducted into the "Hall of Flame"
  24. Wild guess - some sort of shift register maybe?
  25. tripwire

    PWM input

    Table 16 ("TA2 signal connections") on page 33 of the datasheet is a good place to start. The left half of that table shows the inputs for the different module blocks of TA2. For externally connected inputs it gives the corresponding pin numbers for the various package types. In the case of the F5529 this is fairly simple; P2.3-5 are your external inputs to TA2, so the input pins match the output pins. That's not always the case, which is why it's important to check the timer's "signal connections" table in the datasheet. Notice how the table says that the three external inputs are called
  • Create New...