Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Reputation Activity

  1. Like
    sirri reacted to bluehash in [Energia Library] MSTimer2   
    From: Porting MSTimer2
  2. Like
    sirri reacted to energia in [Energia Library] Capacitive Touch library   
    [Edit: New library attached with a bug fix for CapTouch on port 1 in combination with Serial]
    Attached CapTouch.zip is a capacitive touch library for the MSP430. All examples are written for the capacitive touch boosterpack (http://www.ti.com/tool/430boost-sense1). If you do not have one of these then it's fairly simple to create a capacitive sensor from a bare piece of PCB. Just solder a wire to it and hook it up to one of the pins. The library is based on the relaxing oscillator method. Each of the MSP430 pins can be connected to the internal relaxing oscillator peripheral called PinOsc. The PinOsc is a comparator based relaxing oscillator that changes frequency based on a change in capacitance. The idea is to "measure" the capacitance by counting the number of relaxing oscillator cycles during a fixed amount of time. The time during which we measure is called the gate time. So we need a counter to count the number of cycles and a timer to set the gate time during which we count. In this case the watchdog timer in interval mode is used as the gate timer and the capture compare feature of Timer0 is used as the counter. To trigger a measurement, the watchdog timer is set to a certain gate time, the counter start running and the MSP430 is put into LPM3. When the watchdog triggers, the MSP430 wakes up and triggers the capture of the Timer0 counter.
    There is a lot more to it than this though such as baseline tracking, threshold, etc. If you would like to get to the details then I recommend reading the following literature:
    There are 4 examples included in the library to show how to use the API's. To install the library, unzip the attached and copy it to a folder called libraries in you Energia Sketch folder. 
    Include CapTouch.h in your Sketch.
    CapTouch(uint8_t pin, uint8_t sensorType);
    Creates a CapTouch instance and calculates the baseline.
    pin: The pin to use as a capacitive touch or proximity pin.
    sensorType: This is either TOUCH_PROXIMITY for a proximity sensor or TOUCH_BUTTON for a button.
    void setThreshold(uint16_t threshold);
    Sets the threshold that needs to be exceeded for the button to be considered as touched. See isTouched() for more details.
    uint16_t getBaseline();
    Returns the the current baseline value of the last measurement of the untouched sensor. Note that a call to this library does not trigger a measurment.
    uint16_t getMeasured();
    Returns the measured value of the last measurement of the sensor. Not that a call to this library does not trigger a measurment.
    int16_t getDelta();
    Returns the difference between the baseline value and the las measured value. Note that a call to this function does not trigger a measurement.
    uint8_t isTouched();
    If the the difference between the baseline (untouched sensor) and the measured value exceeds the threshold then the button is considered to be touched.
    A call to this function triggers a measurement of the sensor.
    Returns 1 if the sensor is touched otherwise 0.
  3. Like
    sirri reacted to energia in [Energia Library] Capacitive Touch library   
    As a make shift sensor, a wire and tin foil does wonders as a proximity sensor ;-)
  4. Like
    sirri reacted to RobG in MSP430 LaunchPad, 74HC595, 16 LEDs   
    I am powering it directly from LaunchPad, so it's about 3.6V.
    I am using 330ohm resistors to limit the current to about 5mA.
    74HCT595 can source/sink up to 35mA.
    One more thing, I am using HC series, not HCT, sorry for the confusion.
  5. Like
    sirri reacted to RobG in MSP430 LaunchPad, 74HC595, Four 7 Segment Displays   
    For the latest, see this post
    In this example, I have replaced LEDs with four 7 segment displays.
    Note: I am using HC series, not HCT. LaunchPad provides 3.6V, HCT needs 5V.


    #include unsigned int counter = 0; // Counter variable unsigned int digitCounter = 0; // Digit counter unsigned char digit = 0; // Single digit to be displayed unsigned char bcd7digit[10] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F}; // BCD to 7 digit map unsigned char digitSelector[4] = {0x01, 0x02, 0x04, 0x08}; // Digit selector map void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1OUT |= 0x01; // Port P1.0 will be used to latch P1DIR |= 0x01; USICTL0 |= USIPE6 + USIPE5 + USIMST + USIOE; // Out & clk enable, SPI Master USICTL1 |= USICKPH + USIIE; // Counter interrupt, flag remains set USICKCTL = USIDIV_7 + USISSEL_2; // /128 SMCLK USICTL0 &= ~USISWRST; // USI released for operation USICNT = USI16B; // Enable 16 bit CCTL0 = CCIE; // CCR0 interrupt enabled CCR0 = 500; // TACTL = TASSEL_2 + MC_1 + ID_3; // SMCLK, upmode _bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupt } // Timer A0 interrupt service routine #pragma vector = TIMERA0_VECTOR __interrupt void Timer_A (void) { digitCounter++; // Increase digit counter digitCounter &= 0x03; // Mask, counter range is 0-3 digit = counter>>(4 * digitCounter); // Shift digits right digit &= 0x0F; // Mask, we need first digit only USISRL = bcd7digit[digit]; // Get segments from the map USISRH = digitSelector[digitCounter]; // if(digitCounter == 0) { counter = _bcd_add_short(counter, 0x01);// Decimally increase counter's when on first digit } USICNT |= 16; // Start USI } // USI interrupt service routine #pragma vector = USI_VECTOR __interrupt void USI_TXRX (void) { USICTL1 &= ~USIIFG; // Clear pending flag P1OUT &= ~0x01; // Latch data P1OUT |= 0x01; }

  6. Like
    sirri reacted to RichardVowles in DC-DC Converters vs Linear Regulators   
    Looking for advice as software is my thing, I'm still pretty much new to hardware. 
    It would seem that DC-DC Converters (Boost and Buck) would always be the preferred method to get the voltage you require as they are very low loss. Aren't regulators going to burn off a lot of wasted battery current? How do you guys deal with powering your battery operated projects for a long time at 3.3v? 
    A project I'm wanting to work on is that I wanted to create a mesh network of cc2500's with attached water controlling solenoids and soil probes. Most solenoids are 9v or 12v, but i don't think a battery will last very long given the current required to keep it open.
    But when I look at DC-DC converters, they are pretty expensive - Adafruit (who are always more expensive I know) sell a drop-in regulator replacement for $US15. Are there other parts that do as good a job? Or is this something one would just design into a board?
    Any advice appreciated!
  7. Like
    sirri reacted to xv4y in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Well, yes. The method is called settime and takes 3 parameters : hours, minutes and seconds...
    The library by itself does not communicate with anything, but using Serial you could ask for 3 values and then set them as time...
  8. Like
    sirri reacted to xv4y in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hi Sirri,
    Your workaround should work but the problem is not here.
    The problem is that by default, Energia is sourcing the ACLK from the VLO 12 KHz instead of the 32KHz crystal.
    This make the RTC around 2-3 times slower.
    We should be able to change this by settings in the sRTC lib code but unfortunately it does not work as expected.
    Rob is currently working on this issue :
    For now, the right solution is to go inside Energia files to edit the hardware/msp430/cores/msp430/wiring.c file and comment out the line BCSCTL3 |= LFXT1S.
  9. Like
    sirri reacted to energia in Timing in Energia Code ?   
    Also have a look at this library: http://forum.43oh.com/topic/2861-energia-library-mstimer2/
    This library is timer based and calls a user specified function after the set time.
    Github page is here: https://github.com/freemansoft/build-monitor-devices/tree/master/ti_launchpad_rgb
    Do keep in mind that this library uses Timer1 A0 and might conflict with other libraries like TimerSerial.
  10. Like
    sirri reacted to bobnova in Timing in Energia Code ?   
    The "BlinkWithoutDelay" example code that comes with energia (in the digital section) should get you going.
    It looks like that library might function in Energia if copied over. I didn't see any references to Arduino specific HW while glancing through it.
  11. Like
    sirri reacted to abecedarian in Few General Questions About Launchpad   
    Voltage/current limiting is strongly suggested.
  12. Like
    sirri reacted to RichardVowles in Few General Questions About Launchpad   
    But most regulators throw away too much current, defeating the low power purpose? The buck converters from track look awesome but are incredibly expensive. My plan was 3.3v coin battery where possible...
  13. Like
    sirri reacted to cde in Launchpad Rev 1.4 RXD TXD jumpers ?   
    Three of four at r1.5. The r1.4 is currently being used, so I couldn't do it with that (I got female headers on that one anyway.) But yea, the concept works for both boards, and really, for anything where you need to turn a male header into a female one. I use it for the p1.6 led jumper, since the usi i2c uses p1.6, I have to disconnect the jumper for it to work, yet I use some this trick to have another pin toggle that led.
  14. Like
    sirri reacted to jsolarski in Few General Questions About Launchpad   
    1-The internal thermometer is a seperate chip on launchpad or a feature in 2553 chip?
    It is a feature that is part of the ADC, and also SDA on the msp430
    2-Does internal clock works stand alone (apart from launchpad) ?
    What do you mean by stand alone and do you mean the DCO? if you do mean the DCO, yes it is stand alone and run with bare minimum code and in theory you can use the msp430 as a clock generator, as I did to run a 300 baude modem and ref clock
    3-Can we supply msp430xx chip standalone with a 3V battery cell? (I can't find LM1086 3.3V voltage regulator in my city)
    Yes you can power it by a 3v coin cell, I have also ran it on 2 AA/AAA batteries, or add a third to get 3.6v
    4- What is the priority order while coding (energia) among libraries, functions, main code ?
    I have no clue, I dont use energia
  15. Like
    sirri reacted to cde in Launchpad Rev 1.4 RXD TXD jumpers ?   
    Take four jumpers that have open tops instead of closed ones. Place them so that each is on a single pin. Then use some spare cable and stick it into the free side of each one, crossing them over. Like little headers. 

    Or if you soldered on the female headers on your r1.4, then you only need the 2 jumpers. I used 24awg wire, 23awg would fit better.
  16. Like
    sirri reacted to xiaodoudou172 in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hallo I have download your library and it was working fine. But I have a question: why you set the ACLK divided by 8 while the timer clock is also divided by 8? I don't get it.
  17. Like
    sirri reacted to xv4y in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    I have updated the library to be a little bit cleaner :
    Here's the downloads page :
    And, well, guys, I am sorry but I don't think I will put much more work on it.
    It works for my purpose, so...
    I have a DS1307 in my hands but will hook it to an Arduino for a "weather station" project I have. The Arduino having the EEPROM embedded is more suited for this project as it allows to save measurements and compute statistics...
  18. Like
    sirri reacted to Rei Vilo in Reading internal temperature sensor value   
    Depending on your MCU and the revision of the board, the straps are positioned on a different way.
    Please refer to http://github.com/energia/Energia/wiki/Hardware
  19. Like
    sirri reacted to DanAndDusty in Launchpad Rev 1.4 RXD TXD jumpers ?   
    You can do it with 2 female to female jumper wires. I soldered wires across 2 lots of 2 female headers making a 2x2 block with wires soldered across. This is neat and unobtrusive.
    The only non solder job I can think of though is 2 crossed f2f jumper wires.
    Have a great Christmas.
    Sent from my GT-I8160 using Tapatalk 2
  20. Like
    sirri reacted to roadrunner84 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.
  21. Like
    sirri reacted to PentiumPC in Countdown to 21 of December with MSP430 :]   
  22. Like
    sirri reacted to roadrunner84 in Countdown to 21 of December with MSP430 :]   
    Congratulations, it's the 21st, and we're still here
  23. Like
    sirri reacted to G0XAR in Countdown to 21 of December with MSP430 :]   
    I think the Mayans were using a pre release version of Windows 8 when they did their calculations :-)
  24. Like
    sirri reacted to cde in Countdown to 21 of December with MSP430 :]   
    So the Apocalypse didn't come? Then why am I sitting here while these mooses herd everyone into minivans at gunpoint?
  25. Like
    sirri reacted to abecedarian in Countdown to 21 of December with MSP430 :]   
    Not true.
    It was a very early alpha Linux kernel named "Gritty Granite". When they tried to mount more hard disk space to extend the calendar there was a kernel panic which in turn fried the RTC. Therefore, the Mayan calendar doesn't project any farther into the future. ;-)
  • Create New...