roadrunner84 got a reaction from tripwire in MSP430G2312 won't work standalone
With a resistor, so to sum it up:
+---\_/---+ | MSP430G | | | | /RST |---------------+--[47k]--(+) | | | | TEST |--[47k]--+ --- C | | | --- +---------+ | | === === get it? ;-)
Leaving TEST open might work just fine, but you may sometimes boot up and get "stuck" in bootloader/SbW/JTAG mode, pull it down for more robust booting behaviour.
roadrunner84 got a reaction from bluehash in How to use the ldiv math function ?!
When dividing X/Y, you'd call
ldiv_t res; long int X; long int Y; long int quotient; long int remainder; res = ldiv(X,Y); quotient = res.quot; remainder = res.rem;
ldiv_t is a struct containing the integer divided value and the remainder.
so dividing 13 by 5 would give:
numer = 13
denom = 5
quot = 2 (13/5 rounded to zero)
rem = 3 (2 * 5 + 3 = 13)
roadrunner84 got a reaction from mbeals in Timer design question
There are two timers, their type is timer_a3: timer0_a3 and timer1_a3.
Each of these has three capture-and-compare units: TA0.0, TA0.1, TA0.2, TA1.0, TA1.1 and TA1.2.
When using PWM, one can set the timer to either UP mode or CONTINUOUS mode:
- When using UP mode, TA0.0 and TA1.0 set the counter number at which the timer is reset (thus the frequency of your PWM), while the other four can be used to set the PWM duty cycle (percentage).
- When using CONTINUOUS mode, all six can be used to set PWM duty cycles, however the PWM frequency is severely limited since you cannot set a value for the counter reset; it is always 65535 (0xFFFF). You must, however, do a tiny bit of work in software; the "usual PWM modes" (MOD = 3 or 7) will clear on TAx.0, instead use MOD = 1 or 5 and on the TAIFG event (in the TAIV interrupt) manually clear all pins used for the PWM (set MOD to 0, set OUT to 0 or 1, set MOD back to 1 or 5)
You do not mention TA0.2, probably with good reason to do so. However I am unable to find anything indicating it does not exist in the MSP430G2553.
roadrunner84 got a reaction from Rei Vilo in Tips on reducing SRAM footprint with Energia/MSP430
For arduino, progmem may be useful. On the MSP430, the compiler (at least IAR, not sure about CCS and GCC (energia)) will put data in flash whenever it is allowed to. This means that any constant is put in flash, as are hardcoded strings (but not their live copies, they live in RAM if any non const char const is met in the usage path). This is mastly due to the architecture of the MSP430; all memory (flash, RAM, FRAM and EEPROM) share one memory space. From the program's perspective, accessing flash for read is just as difficult as accessing RAM for read.
roadrunner84 got a reaction from sirri in Serial communication not working?
Hardware based is using the serial interface hardware, embedded in the MSP430. It requires you to put a byte in memory and will serialize it for you.
Software based will trigger the timer interrupt every bit and the software will set the I/O pin to the level corresponding with the desired bit.
roadrunner84 got a reaction from vinicius.jlantunes in Using Timer to implement a "sleep / wait" function
Yes, you need to be very careful about when you assume you have access to which clock sources. When in LPM4, you don't have any clocksources available, in LPM3 you can only use the ACLK clock (so only the LFXT1 or VLO clock source).
In my projects, I mostly reside in LPM0 to cause a "wait until", or in LPM3 when I want to go to low power mode. In the latter case I make sure to wake up at a timer (sources from ACLK) or a pin interrupt.
roadrunner84 got a reaction from hova in Goofy board?!
I'm not familiar with MSP430 assembler, but I assume that #00001000 means that is is a binary value.
You should still check against P1IN, but you should set the P1REN and P1OUT bits first
bis.b #00001000, &P1REN bis.b #00001000, &P1OUT MainLoop bit.b #00001000, &P1IN jc Off
@hova: that's not (perse) captouch, as the pin is not biased toward ground or supply, it's actually very sensitive to biasing through anything. You're probably "shorting" supply and the button pin with your hand (which has a resistance of several megaohms, not infinity), that's why you should always use defined levels (using REN, external resistors or a input that never floats). The family guides of TI mention you should never leave pins unattached, unless you're setting them as output or use REN to define their level, if not, the input may oscillate, consuming unacceptable current in the input circuitry.
roadrunner84 got a reaction from PentiumPC in MSP430 LaunchPad Tachometer.
I have two suggestions:
Your video shows only even values, which suggests you display values twice that of your minimum sensitivity.
Your main() function loops until a flag set in the interrupt is true. Instead, you could let the main() loop sleep (using __low_power_mode_0() for example, verify whether you need SMCLK clock, if not, you could probably get away with using __low_power_mode_3() as well)
So at the point you'd "poll" for the flag, instead enter low power mode, at the place where you'd normally st the flag, now clear it (as you're currently doing in the main loop) and call the __leave_low_power_on_exit() intrinsic (or something similar if using CCS/GCC).
Now instead of looping and looping until the flag is set, your processor sleeps until the interrupt occurs, at which moment the processor will wake, handle the interrupt and (if needed) keep the processor from going to sleep again, thus executing the main loop for you.
I was mistaking on the stuff about even values: you use ((something)/10)*6, however, this is integer calculation. This means you're actually throwing data away by /10, then you multiply this integer value by 6. Instead, you could do ((something)*6)/10 which would discard less information.
You do need to verify that your value will actually fit in the type of your variable.
So if RPM_buffer is unsigned short, the value must not exceed 1092 (as you add 10 of them and multiply by 6 in the end).
Also, as the values in RPM_buffer are 327680 / value, you could move the times 6 here. so (6*327680)/value. This would decrease your quantization error even more.
roadrunner84 got a reaction from hova in Goofy board?!
You can use the reset button as an input, you'll have to use the NMI handler for that.
Check out this post on TI's expert to expert forum: http://e2e.ti.com/su...66/t/71305.aspx
You have some great restrictions though:
- you cannot set up pull-up/down
- you can only detect edges, not levels (i.e.: "button depressed" or "button released", not "button high" "button low")
- you must still use the pull-up resistor, as it is the reset line as well (so the button must be connected to ground)
- you cannot debug and use this button simultaniously (as this pin is also used for the Spy-Bi Wire interface)