Jump to content
43oh

oPossum

Members
  • Content Count

    925
  • Joined

  • Last visited

  • Days Won

    103

Reputation Activity

  1. Like
    oPossum got a reaction from bluehash in ringLight. A WS2812 led based light for my 3d printer.   
    12V - 5V = 7V
     
    7V * 0.5A = 3.5W
     
    So you need a heatsink that will get rid of that 3.5 watts with acceptable temperature rise. It's in a SOIC package, so that's not really possible.
     
    So... use a TO-220 package regulator with a heatsink or a switching regulator.
  2. Like
    oPossum reacted to greeeg in ringLight. A WS2812 led based light for my 3d printer.   
    Cool project, these LEDs are so versatile
     
    Another option, is to place a high wattage resistor in series before your LDO.
    This could be done now, the resistor could be mounted on a small heatsink somewhere in your printer, and the then a cable can run from that to the LEDs.
     
    R = V/I = 5/0.5 = 10R
    P = 2.5W
     
    Then the LDO's power dissipation,
    V_drop = 7 - 5 = 2.
    P = 2 * 0.5 = 1 W.
     
    That is still high, but now a 3x improvement.
  3. Like
    oPossum got a reaction from timotet in ringLight. A WS2812 led based light for my 3d printer.   
    12V - 5V = 7V
     
    7V * 0.5A = 3.5W
     
    So you need a heatsink that will get rid of that 3.5 watts with acceptable temperature rise. It's in a SOIC package, so that's not really possible.
     
    So... use a TO-220 package regulator with a heatsink or a switching regulator.
  4. Like
    oPossum got a reaction from simpleavr in Simulating a TI calculator with crazy 11-bit opcodes   
    Maybe you could design the PCB to allow for an LED bubble display or a 1x8 LCD display. The LCD would be less authentic, but allow for better battery life and better readability under bright light.
     
    http://www.mouser.com/ds/2/291/NHD-0108FZ-RN-YBW-33152.pdf
  5. Like
    oPossum reacted to simpleavr in Simulating a TI calculator with crazy 11-bit opcodes   
    Bump.
     
    Finally moved the emulator to a single PCB design (after one failed PCB design). Now my kids can take them and use them in school.
     
    Source code can be found at https://github.com/simpleavr/tms0800.
     
    Source code based on Ken Shirriff and other's work, please see http://righto.com/ti and http://righto.com/sinclair
     

     
    A few photos...
     

     
    PCB design available upon request.
     
     
  6. Like
    oPossum reacted to esteimle in Open source wireless dev system   
    Well I thought I'd shamelessly post my MSP430 project here and see what people think of it ( I asked the mods first   Anyway it's a two part CC430 system with an access point and wireless endpoint.   The AP runs a small ethernet webserver that takes variables, and commands from a browser or an iphone app, and sends them to it's endpoints.   Then you can activate the endpoint's, relay, leds, or read it's opto isolator input, or A2D channels.  I made a indiegogo for it here to see if I can get it FCC certed https://www.indiegogo.com/projects/konexs-wireless-development-kit/x/7274449  Even if that doesn't work out it was still fun to work on   Thanks for checking it out!
     

  7. Like
    oPossum got a reaction from GeekDoc in request: ultrasonic example   
    #include <msp430.h>
    #include <stdint.h>
     
    static const unsigned long smclk_freq = 16000000UL; // SMCLK frequency in hertz
    static const unsigned long bps = 9600UL; // Async serial bit rate
     
    static uint32_t upd = 0; // Ultrasonic Pulse Duration (500 ns resolution)
    //
    #pragma vector = TIMER1_A1_VECTOR // Timer 1A vectored interrupt
    __interrupt void timer1_a1_isr(void) //
    { //
    static uint32_t rise = 0; // Pulse rise time
    static uint32_t fall; // Pulse fall time
    //
    switch(TA1IV) { // TA0IV must be read to reset interrupt
    case 0x02: // 0x02 == CCR1 (capture/compare)
    if(TA1CCTL1 & CCI) { // - Rising edge
    rise = TA1CCR1; // Save rise time
    fall = 0; // Reset fall time
    } else { // - Falling edge
    if(rise) { // Make sure rising edge has occurred
    // Handle possible pending overflow interrupt
    if((TA1CTL & TAIFG) && (TA1CCR0 < 0x1000))
    fall += TA1CCR0; //
    fall += TA1CCR1; // Get fall time, add to overflow time
    if(!upd) upd = fall - rise; // Update time if mainline code is ready for it
    rise = 0; // Clear rise time to ensure next rising edge is used
    } //
    } //
    break; //
    case 0x0A: // 0x0A == TAIFG (overflow)
    fall += TA1CCR0; // Update overflow time
    break; //
    } //
    } //
     
    void putc(const unsigned c) // Output single char to serial
    { //
    while(!(IFG2 & UCA0TXIFG)); // Wait for ready (not busy)
    IFG2 &= ~UCA0TXIFG; // Reset busy flag
    UCA0TXBUF = c; // Tx char
    } //
    //
    void puts(const char *s) { while(*s) putc(*s++); } // Output string to serial
    //
    void print_u32(uint32_t n, const unsigned dp) // Print 32 bit unsigned with optional decimal place
    // 6 decimal digits (0 -> 999999)
    { //
    unsigned c; //
    c = '0'; while(n >= 100000UL) n -= 100000UL, ++c; putc(c);
    if(dp == 5) putc('.'); //
    c = '0'; while(n >= 10000) n -= 10000, ++c; putc(c);
    if(dp == 4) putc('.'); //
    c = '0'; while(n >= 1000) n -= 1000, ++c; putc(c);
    if(dp == 3) putc('.'); //
    c = '0'; while(n >= 100) n -= 100, ++c; putc(c);
    if(dp == 2) putc('.'); //
    c = '0'; while(n >= 10) n -= 10, ++c; putc(c); //
    if(dp == 1) putc('.'); //
    c = '0'; while(n) --n, ++c; putc(c); //
    } //
     
    void main(void) //
    { //
    WDTCTL = WDTPW | WDTHOLD; // Disable watchdog reset
    DCOCTL = 0; // Run at 16 MHz
    BCSCTL1 = CALBC1_16MHZ; //
    DCOCTL = CALDCO_16MHZ; //
    //
    P1DIR = BIT2; // Setup GPIO
    P1SEL = BIT1 | BIT2; // UART
    P1SEL2 = BIT1 | BIT2; //
    //
    P2OUT = 0; //
    P2DIR = BIT0; // Timer 1 capture/compare IO
    P2SEL = BIT0 | BIT1; //
    P2SEL2 = 0; //
    //
    const unsigned long brd = (smclk_freq + (bps >> 1)) / bps; // Bit rate divisor
    UCA0CTL1 = UCSWRST; // Hold USCI in reset to allow configuration
    UCA0CTL0 = 0; // No parity, LSB first, 8 bits, one stop bit, UART (async)
    UCA0BR1 = (brd >> 12) & 0xFF; // High byte of whole divisor
    UCA0BR0 = (brd >> 4) & 0xFF; // Low byte of whole divisor
    UCA0MCTL = ((brd << 4) & 0xF0) | UCOS16; // Fractional divisor, oversampling mode
    UCA0CTL1 = UCSSEL_2; // Use SMCLK for bit rate generator, release reset
    //
    // Timer 1 compare 0
    TA1CCR0 = (16000000UL / (8 * 2 * 20)) - 1; // 20 Hz (50 ms)
    TA1CCTL0 = OUTMOD_4; // Toggle mode
    // Timer 1 capture 1
    TA1CCTL1 = CM_3 | SCS | CAP | CCIE; // Rising and falling, sync, capture, interrupt
    // Timer 1 config
    TA1CTL = TASSEL_2 | ID_3 | MC_1 | TAIE; // SMCLK, /8, count up, overflow interrupt
    //
    _enable_interrupts(); // Enable interrupts
    //
    for(; { // For-ever
    if(upd) { // Check for pulse duration measuement available
    // Calculate inches
    const uint32_t in = ((upd * 5534) + (upd >> 1)) >> 14;
    // Calculate mm
    const uint32_t mm = (upd * 5623) >> 16;
    //
    print_u32(in, 2); // Print inches
    puts(" in "); //
    print_u32(mm, 0); // Print mm
    puts(" mm"); //
    puts("\r\n"); //
    upd = 0; // Ready for next
    } //
    } //
    } //

  8. Like
    oPossum got a reaction from Rei Vilo in Newbie general C code question   
    When the max value is less than 2^8 (256): uint_fast8_t
    When the max value is less than 2^16 (65536): uint_fast16_t
    When the max value is less than 2^32 (4,294,967,296): uint_fast32_t
    When the max value is less than 2^64 (aprox 1.8E19): uint_fast64_t
     
    These fast variants will be promoted to the best suitable integer type. That will typically be an integer multiple of the register width. So on the MSP430, uint_fast8_t becomes unsigned [16 bit]. On x86 it would be 16, 32 or 64 bits depending on target operating mode. This doesn't matter much on the MSP430, but it does on some others such as 16 bit PIC.
  9. Like
    oPossum got a reaction from tripwire in Newbie general C code question   
    When the max value is less than 2^8 (256): uint_fast8_t
    When the max value is less than 2^16 (65536): uint_fast16_t
    When the max value is less than 2^32 (4,294,967,296): uint_fast32_t
    When the max value is less than 2^64 (aprox 1.8E19): uint_fast64_t
     
    These fast variants will be promoted to the best suitable integer type. That will typically be an integer multiple of the register width. So on the MSP430, uint_fast8_t becomes unsigned [16 bit]. On x86 it would be 16, 32 or 64 bits depending on target operating mode. This doesn't matter much on the MSP430, but it does on some others such as 16 bit PIC.
  10. Like
    oPossum got a reaction from pabigot in Newbie general C code question   
    When the max value is less than 2^8 (256): uint_fast8_t
    When the max value is less than 2^16 (65536): uint_fast16_t
    When the max value is less than 2^32 (4,294,967,296): uint_fast32_t
    When the max value is less than 2^64 (aprox 1.8E19): uint_fast64_t
     
    These fast variants will be promoted to the best suitable integer type. That will typically be an integer multiple of the register width. So on the MSP430, uint_fast8_t becomes unsigned [16 bit]. On x86 it would be 16, 32 or 64 bits depending on target operating mode. This doesn't matter much on the MSP430, but it does on some others such as 16 bit PIC.
  11. Like
    oPossum reacted to TI_Trey in Quadcopter BoosterPack   
    Hi 43oh!
     
    Some of you may have seen me over at c2kcentral, but I'm mostly a lurker here.  For a while now, I've been working on developing a low cost quadcopter.  Well that quadcopter is nearly done!  Boards are being manufactured as I type this, and I plan to have it flying at the Bay Area MakerFaire in May.
     
    Here's a picture of the top of the motor driver board:

     
    Personally, I would like to see this manufactured and sold, but before I invest the effort to do that I need to ensure there is a demand for such a board.  The finished quad will be about 1 square foot in size, will cost ~$200, and will be able to carry a small payload (I've got my fingers crossed we'll have enough thrust for a Go Pro).  If you would please take a second to answer the poll as to whether or not you would be interested in purchasing one.
     
    This is all very preliminary, but I appreciate any feedback you may have.
     
    Thanks!
     
    Edit:
    Moving some of the information regarding the setup up here:
     
    4x TMS320F28027F + DRV8312 make up the ESC.  That is the bulk of what is on the board which you can see on the first post.
    1x C2000 LP acts as the brain.  This board decodes the control signals and sends torque commands to each of the ESCs via a PWM signal.  This LaunchPad runs the open source AeroQuad firmware on top of Energia...which also means other LaunchPads could be used as the brain.
    Control Inputs come via a standard RC 2.4GHz radio and receiver.  Because the LaunchPad doesn't have 1 million capture inputs I am using a receiver which supports S.Bus.
    3 axis accelerometer, gyro, magnetometer, barometer and GPS
     
    Update 4/16:
    Got the IMU board in today.  Here's a picture:

     
    Yellow - TC6000GN - CC4000 based GPS
    Red - MPU6000 - 6 axis IMU
    Blue - HMC5983 - 3 axis Mag
    Purple - MS5611 Barometer
     
    Update 4/21:
    Got in a car accident and have been dealing with insurance, so instead of working on this I've been dealing with BS.  Good news is that all that is finally taken care of and the motor boards are here!  These are by far the most complex and visually appealing boards I've even designed.  Take a look:

     
    I'm still waiting on a few structural pieces to arrive which are being water cut.  I expect I'll have them later this week.  I'll post some more pictures once I get the boards assembled.
     
    Update 4/22:
    Motor boards are assembled and basic functionality checks out.  Next checks will include JTAG connectivity, and then motor drive capability.  The design is based off an earlier prototype that was proven out, so I expect everything to work splendidly on this board.

     
     
    If you're not already, follow me on twitter for up to the minute project updates! @yertnamreg1218
     
    Update 4/24:
    The 4 InstaSpin Piccolos are all in a JTAG chain.  Initially I had a little trouble getting CCS to connect, but after a little re-soldering of the ICs JTAG started working.  I now have all 4 device programmed with the motor control software.  I was also able to verify operating on a battery and the serial data link between the receiver and main microcontroller.

     
    Yes, I'm aware my desk is a mess right now. :-P
     
    Update 5/6:
    Lots of work has been going into the AeroQuad firmware I'll be running on the LaunchPad.  The two main contenders for firmware were Arducopter and Aeroquad.  The reason Aeroquad was chosen over Arducopter was their use of the standard Arduino IDE to build their firmware.  Arducopter uses a hacked together one off build system.  Since Energia is based off Arduino, getting the AeroQuad project to build was much easier than Arducopter would have been.  
     
    With that said, I'm happy to announce that today I was able to compile AeroQuad successfully for the C2k LaunchPad in Energia.  This is a huge milestone!

     
    As you can see it didn't link, but that's an easy problem to fix.  With MakerFaire less than 2 week away, the pressure is on!  Will Trey get the quadcopter flying in time or will Murphy raise his evil head and sabotage the project?  Stay tuned to find out!
     
    Update 5/23:
    After my last update I had to really focus on getting the thing done in time for MakerFaire, so I slacked off on project updates.  Sadly, Murphy paid me a visit and threw a few wrenches into my plan.
     
    Problem #1: Everything on the motor drive boards appears to be working as planned with the exception of the current feedback circuitry for the motors.  The old board can spin the motors just fine, but on the new board the current feedback isn't behaving nicely which is causing us problems with the motor control software.  The boards are based on the same schematic, but the original developer changed some of the components in the feedback circuitry.  I have a list of the changes and the new board has incorporated those changes, but still has problems.  I'm unsure if the issue is layout or component related and will be doing some experiments in the coming weeks to determine and fix the cause.
     
    Problem #2: I pulled a special favor to get the structural materials (i.e. frame) for the quadcopter cut on a waterjet.  I kicked this off in early April, but because it was a favor and there were other users of this machine my parts didn't end up getting cut in time.  I'm currently looking for a place in town that can do CNC routing and drilling to get these parts cut.
     
    MakerFaire was still a big success and I was able to talk to a ton of people about LaunchPad, Energia, and the quadcopter.  I even met a few 43oh members while I was there!  I also talked to the creators of the Aeroquad firmware and they are very excited about this project.  Once the C2000 port is more stable I will be merging my changes upstream to the main Aeroquad repository.  
     
    I also talked to them about structural materials for the frame.  The Aeroquad guys use a material called DiBond.  Its a composite aluminum/polyethylene laminate which is less dense than FR4 with comparable material properties.  It is commonly used in signage applications, but also makes for an excellent quadcopter frame.  At MakerFaire the AeroQuad team participated in an event called the "Game of Drones".  This event pitted two quadcopters against eachother in air to air combat.  Take a look at this video showing off some of the fights: 
     

    http://youtu.be/91OCQ-1KP08
     
    After seeing how well they performed in the competition I am considering switching to use DiBond as the structural material in my quadcopter as well.
     
    Update 8/19
    It took me a while to find someone to cut the frame at a reasonable price, but I finally did.  I just received the frame back from the fabricator and it looks great.  I'll still need to tweak the design a bit due to machining tolerances, but that's something that's easily accomplished.  Without further ado, here are the pics:

     

     
    There are some spars that connect the two pieces together that should also be here, but the fabricator was confused and thought they were scrap.  I should be able to fully assembled the quad after I get back the tweaked version of the frame.
     
    I also was lucky enough to be a guest on "The Amp Hour" this week.  Be sure to tune in!  I talk about my experience in college at Rose-Hulman, my first job after college with Simma Software, and I reveal a new job I've accepted at TI!!!!
  12. Like
    oPossum reacted to cubeberg in 43oh badge   
    This project was a collaboration with Texas Instruments.  I've kept it hush-hush so far, but as of yesterday - it's finally out in the wild!  Yesterday at the SF Maker Faire, Texas Instruments started giving away boards at their booth.  If you're visiting the Maker Faire today - please drop by booth 220!
     
    Thanks a ton to TI for sponsoring and feedback on the design.  Will Cooper, Adrian Fernandez, Mark Easley, Dung Dang and Rachel Platis were all involved - this wouldn't have happened without them.
    Also - Elecrow did a wonderful job on the boards and initial kitting (I added the batteries and MCU once back in the US).  
     
    Badge page on 43oh - http://43oh.com/badge/  (drop by this page for more info and an intro video).
    Github with schematics, sample code, etc. : https://github.com/dd430/430RocketBadge
     
    The board is intended to be easy to solder - parts were kept to a minimum.  It showcases several features of the MSP430G line.  The board has a Cap Touch slider as well as 5 LEDs.  The pre-programmed demo starts in a POV mode.  If you swing the badge in a circle, you'll see the pre-programmed messages written in the air.  My favorite part of the project though - has to be the ability to update the message on the badge via the light sensors on the board.  You may have seen similar projects.  One sensor is used for the clock, another for the data.  A simple web page allows design of a message and then uses two squares on the page to trigger high/low values on the light sensors.  You can find it at the 43oh badge page above.
     
    All in all - we were able to get 500 kits created.  Hopefully these will be given away at events that TI is attending for quite a while.  I'll post back if I hear they're going to show up for an event.  Hopefully we'll also have a few to give away to forum members as well.  
     
    BTW - I will say - creating 500 kits of something is a significantly different endeavor than just a handful
     
    Boards after manufacture:

     
    500 kits arrived at my house:

     
    I started with several ideas for the board initially - but we ultimately ended with the POV design.  V1 of the design used a shift register to control the LEDs and took significantly longer to solder.  Not the best for a beginner kit  Not to mention getting the clock working with the shift register was a bit squirly for some reason.
     
    V1 badge vs V2

     
  13. Like
    oPossum reacted to pabigot in Heap / Stack pointer   
    Egads. Yes, I suppose it may work.
     
    The standard "intrinsic" in CCS is _get_SP_register() and msp430-elf-gcc should provide the same. mspgcc provides __read_stack_register() (it might not have the alias, in which case energia should probably add it).
     
    Any toolchain should have something that does this for you without having to introduce undefined behavior.
  14. Like
    oPossum got a reaction from spirilis in Heap / Stack pointer   
    This may work for getting the stack pointer...
     

    unsigned * get_sp(void) { unsigned n; return &n; }
  15. Like
    oPossum got a reaction from jsolarski in request: ultrasonic example   
    #include <msp430.h>
    #include <stdint.h>
     
    static const unsigned long smclk_freq = 16000000UL; // SMCLK frequency in hertz
    static const unsigned long bps = 9600UL; // Async serial bit rate
     
    static uint32_t upd = 0; // Ultrasonic Pulse Duration (500 ns resolution)
    //
    #pragma vector = TIMER1_A1_VECTOR // Timer 1A vectored interrupt
    __interrupt void timer1_a1_isr(void) //
    { //
    static uint32_t rise = 0; // Pulse rise time
    static uint32_t fall; // Pulse fall time
    //
    switch(TA1IV) { // TA0IV must be read to reset interrupt
    case 0x02: // 0x02 == CCR1 (capture/compare)
    if(TA1CCTL1 & CCI) { // - Rising edge
    rise = TA1CCR1; // Save rise time
    fall = 0; // Reset fall time
    } else { // - Falling edge
    if(rise) { // Make sure rising edge has occurred
    // Handle possible pending overflow interrupt
    if((TA1CTL & TAIFG) && (TA1CCR0 < 0x1000))
    fall += TA1CCR0; //
    fall += TA1CCR1; // Get fall time, add to overflow time
    if(!upd) upd = fall - rise; // Update time if mainline code is ready for it
    rise = 0; // Clear rise time to ensure next rising edge is used
    } //
    } //
    break; //
    case 0x0A: // 0x0A == TAIFG (overflow)
    fall += TA1CCR0; // Update overflow time
    break; //
    } //
    } //
     
    void putc(const unsigned c) // Output single char to serial
    { //
    while(!(IFG2 & UCA0TXIFG)); // Wait for ready (not busy)
    IFG2 &= ~UCA0TXIFG; // Reset busy flag
    UCA0TXBUF = c; // Tx char
    } //
    //
    void puts(const char *s) { while(*s) putc(*s++); } // Output string to serial
    //
    void print_u32(uint32_t n, const unsigned dp) // Print 32 bit unsigned with optional decimal place
    // 6 decimal digits (0 -> 999999)
    { //
    unsigned c; //
    c = '0'; while(n >= 100000UL) n -= 100000UL, ++c; putc(c);
    if(dp == 5) putc('.'); //
    c = '0'; while(n >= 10000) n -= 10000, ++c; putc(c);
    if(dp == 4) putc('.'); //
    c = '0'; while(n >= 1000) n -= 1000, ++c; putc(c);
    if(dp == 3) putc('.'); //
    c = '0'; while(n >= 100) n -= 100, ++c; putc(c);
    if(dp == 2) putc('.'); //
    c = '0'; while(n >= 10) n -= 10, ++c; putc(c); //
    if(dp == 1) putc('.'); //
    c = '0'; while(n) --n, ++c; putc(c); //
    } //
     
    void main(void) //
    { //
    WDTCTL = WDTPW | WDTHOLD; // Disable watchdog reset
    DCOCTL = 0; // Run at 16 MHz
    BCSCTL1 = CALBC1_16MHZ; //
    DCOCTL = CALDCO_16MHZ; //
    //
    P1DIR = BIT2; // Setup GPIO
    P1SEL = BIT1 | BIT2; // UART
    P1SEL2 = BIT1 | BIT2; //
    //
    P2OUT = 0; //
    P2DIR = BIT0; // Timer 1 capture/compare IO
    P2SEL = BIT0 | BIT1; //
    P2SEL2 = 0; //
    //
    const unsigned long brd = (smclk_freq + (bps >> 1)) / bps; // Bit rate divisor
    UCA0CTL1 = UCSWRST; // Hold USCI in reset to allow configuration
    UCA0CTL0 = 0; // No parity, LSB first, 8 bits, one stop bit, UART (async)
    UCA0BR1 = (brd >> 12) & 0xFF; // High byte of whole divisor
    UCA0BR0 = (brd >> 4) & 0xFF; // Low byte of whole divisor
    UCA0MCTL = ((brd << 4) & 0xF0) | UCOS16; // Fractional divisor, oversampling mode
    UCA0CTL1 = UCSSEL_2; // Use SMCLK for bit rate generator, release reset
    //
    // Timer 1 compare 0
    TA1CCR0 = (16000000UL / (8 * 2 * 20)) - 1; // 20 Hz (50 ms)
    TA1CCTL0 = OUTMOD_4; // Toggle mode
    // Timer 1 capture 1
    TA1CCTL1 = CM_3 | SCS | CAP | CCIE; // Rising and falling, sync, capture, interrupt
    // Timer 1 config
    TA1CTL = TASSEL_2 | ID_3 | MC_1 | TAIE; // SMCLK, /8, count up, overflow interrupt
    //
    _enable_interrupts(); // Enable interrupts
    //
    for(; { // For-ever
    if(upd) { // Check for pulse duration measuement available
    // Calculate inches
    const uint32_t in = ((upd * 5534) + (upd >> 1)) >> 14;
    // Calculate mm
    const uint32_t mm = (upd * 5623) >> 16;
    //
    print_u32(in, 2); // Print inches
    puts(" in "); //
    print_u32(mm, 0); // Print mm
    puts(" mm"); //
    puts("\r\n"); //
    upd = 0; // Ready for next
    } //
    } //
    } //

  16. Like
    oPossum got a reaction from Rickta59 in request: ultrasonic example   
    #include <msp430.h>
    #include <stdint.h>
     
    static const unsigned long smclk_freq = 16000000UL; // SMCLK frequency in hertz
    static const unsigned long bps = 9600UL; // Async serial bit rate
     
    static uint32_t upd = 0; // Ultrasonic Pulse Duration (500 ns resolution)
    //
    #pragma vector = TIMER1_A1_VECTOR // Timer 1A vectored interrupt
    __interrupt void timer1_a1_isr(void) //
    { //
    static uint32_t rise = 0; // Pulse rise time
    static uint32_t fall; // Pulse fall time
    //
    switch(TA1IV) { // TA0IV must be read to reset interrupt
    case 0x02: // 0x02 == CCR1 (capture/compare)
    if(TA1CCTL1 & CCI) { // - Rising edge
    rise = TA1CCR1; // Save rise time
    fall = 0; // Reset fall time
    } else { // - Falling edge
    if(rise) { // Make sure rising edge has occurred
    // Handle possible pending overflow interrupt
    if((TA1CTL & TAIFG) && (TA1CCR0 < 0x1000))
    fall += TA1CCR0; //
    fall += TA1CCR1; // Get fall time, add to overflow time
    if(!upd) upd = fall - rise; // Update time if mainline code is ready for it
    rise = 0; // Clear rise time to ensure next rising edge is used
    } //
    } //
    break; //
    case 0x0A: // 0x0A == TAIFG (overflow)
    fall += TA1CCR0; // Update overflow time
    break; //
    } //
    } //
     
    void putc(const unsigned c) // Output single char to serial
    { //
    while(!(IFG2 & UCA0TXIFG)); // Wait for ready (not busy)
    IFG2 &= ~UCA0TXIFG; // Reset busy flag
    UCA0TXBUF = c; // Tx char
    } //
    //
    void puts(const char *s) { while(*s) putc(*s++); } // Output string to serial
    //
    void print_u32(uint32_t n, const unsigned dp) // Print 32 bit unsigned with optional decimal place
    // 6 decimal digits (0 -> 999999)
    { //
    unsigned c; //
    c = '0'; while(n >= 100000UL) n -= 100000UL, ++c; putc(c);
    if(dp == 5) putc('.'); //
    c = '0'; while(n >= 10000) n -= 10000, ++c; putc(c);
    if(dp == 4) putc('.'); //
    c = '0'; while(n >= 1000) n -= 1000, ++c; putc(c);
    if(dp == 3) putc('.'); //
    c = '0'; while(n >= 100) n -= 100, ++c; putc(c);
    if(dp == 2) putc('.'); //
    c = '0'; while(n >= 10) n -= 10, ++c; putc(c); //
    if(dp == 1) putc('.'); //
    c = '0'; while(n) --n, ++c; putc(c); //
    } //
     
    void main(void) //
    { //
    WDTCTL = WDTPW | WDTHOLD; // Disable watchdog reset
    DCOCTL = 0; // Run at 16 MHz
    BCSCTL1 = CALBC1_16MHZ; //
    DCOCTL = CALDCO_16MHZ; //
    //
    P1DIR = BIT2; // Setup GPIO
    P1SEL = BIT1 | BIT2; // UART
    P1SEL2 = BIT1 | BIT2; //
    //
    P2OUT = 0; //
    P2DIR = BIT0; // Timer 1 capture/compare IO
    P2SEL = BIT0 | BIT1; //
    P2SEL2 = 0; //
    //
    const unsigned long brd = (smclk_freq + (bps >> 1)) / bps; // Bit rate divisor
    UCA0CTL1 = UCSWRST; // Hold USCI in reset to allow configuration
    UCA0CTL0 = 0; // No parity, LSB first, 8 bits, one stop bit, UART (async)
    UCA0BR1 = (brd >> 12) & 0xFF; // High byte of whole divisor
    UCA0BR0 = (brd >> 4) & 0xFF; // Low byte of whole divisor
    UCA0MCTL = ((brd << 4) & 0xF0) | UCOS16; // Fractional divisor, oversampling mode
    UCA0CTL1 = UCSSEL_2; // Use SMCLK for bit rate generator, release reset
    //
    // Timer 1 compare 0
    TA1CCR0 = (16000000UL / (8 * 2 * 20)) - 1; // 20 Hz (50 ms)
    TA1CCTL0 = OUTMOD_4; // Toggle mode
    // Timer 1 capture 1
    TA1CCTL1 = CM_3 | SCS | CAP | CCIE; // Rising and falling, sync, capture, interrupt
    // Timer 1 config
    TA1CTL = TASSEL_2 | ID_3 | MC_1 | TAIE; // SMCLK, /8, count up, overflow interrupt
    //
    _enable_interrupts(); // Enable interrupts
    //
    for(; { // For-ever
    if(upd) { // Check for pulse duration measuement available
    // Calculate inches
    const uint32_t in = ((upd * 5534) + (upd >> 1)) >> 14;
    // Calculate mm
    const uint32_t mm = (upd * 5623) >> 16;
    //
    print_u32(in, 2); // Print inches
    puts(" in "); //
    print_u32(mm, 0); // Print mm
    puts(" mm"); //
    puts("\r\n"); //
    upd = 0; // Ready for next
    } //
    } //
    } //

  17. Like
    oPossum got a reaction from bluehash in Products using MSP430   
    Apple G5 PowerMac (PCI version, circa 2004)
     

     
    There where also several other TI chips for power management and firewire on the huge motherboard.
  18. Like
    oPossum got a reaction from chicken in Products using MSP430   
    Apple G5 PowerMac (PCI version, circa 2004)
     

     
    There where also several other TI chips for power management and firewire on the huge motherboard.
  19. Like
    oPossum got a reaction from pine in Products using MSP430   
    Apple G5 PowerMac (PCI version, circa 2004)
     

     
    There where also several other TI chips for power management and firewire on the huge motherboard.
  20. Like
    oPossum got a reaction from RobG in Products using MSP430   
    Apple G5 PowerMac (PCI version, circa 2004)
     

     
    There where also several other TI chips for power management and firewire on the huge motherboard.
  21. Like
    oPossum got a reaction from spirilis in Products using MSP430   
    Apple G5 PowerMac (PCI version, circa 2004)
     

     
    There where also several other TI chips for power management and firewire on the huge motherboard.
  22. Like
    oPossum reacted to juanb in Digital Thermographic Camera   
    Hi everyone,
    My name is Juan Beroy from John Brown Univeristy and this is my final project for my embedded systems class.
    The objective of this project, the Digital Thermographic Camera, is to demonstrate the usage of the Texas Instruments MSP430 G2553 microcontroller to control the various parts of the project. The project consists of two servo motors, a set of DC batteries, a MLX90614ESF-BCI-000-TU infrared sensor, as well as a RS-232 serial connection to establish connection with the computer. The signals used to control the servo motors are sent using two different pins of the microcontroller. At the same time, the Inter Integrated Circuit (I2C) synchronous communication mode was used to read the data (temperature measurements) coming from the infrared sensor.
    Attached is a table summarizing the main conmponenents of this project as well as their purposes. If you need more info please contact me.

    Projects parts table.pdf
  23. Like
    oPossum reacted to pabigot in MSP430 GCC - does it support 20 bit addressing?   
    The 4.7 dev version of mspgcc which supports 20-bit addresses tried to support mixed memory models so code could be small with data large, or vice-versa, but GCC wasn't architected for that sort of thing so there can be issues.
     
    AFAIK the Red Hat port supports only everything-16-bit and everything-32-bit, with -mlarge having a pretty big impact on code and data size (all pointers and size_t become 32-bit). I don't have a lot of experience with it, though, since a feature I need that's in the CCS6 version still hasn't been made available in the upstream source repositories.
  24. Like
    oPossum got a reaction from bluehash in MSP430 Quadrotor ***attempt***   
    Generate PPM with the MSP430, and then convert it to multiple PWM with a CD4017.
     
    http://forum.43oh.com/topic/1226-rcremote-can-also-be-used-to-control-8-servos/
     
    Thanks for sharing your project!
  25. Like
    oPossum reacted to JBUKarl in MSP430 Quadrotor ***attempt***   
    Hello fellow bloggers!
    My name is Karl Anderson, I am a junior at John Brown University, studying electrical engineering. I have been working with a colleague, David Bird (also a junior EE major at JBU) on a quadrotor project for the past six weeks. Below you will find a table with the parts we used:
     
     
    Item
    Cost
    5g Brushless Motors * 4
    $34.92
    Turnigy Plush ESC 6A * 4
    $32.80
    10DOF Sensor Board
    $22.60
    Zippy 800 maH LiPo
    $4.42
    TX & RX
    $25.07
    Frame Tubing
    (window screen tubing)
    $3.24
    MSP430G2553 LaunchPad
    $9.99
    Propellors
    $3.49
    3.3V Regulator
    $1.95
    20 Pin DIP Socket
    $0.49
    20 Pin IC Breakout
    $2.49
    10k? Resistors * 3
    $0.00
    Jumper Wires
    $0.00
        Paid Total
    $98.23
    Complete Total
    $141.46
    Key: Paid/Donated
       
     
    And their links if purchased online:
    eBay
     
    Sensor:
    http://www.ebay.com/itm/10DOF-IMU-HMC5883L-ITG3205-BMA180-BMP085-Sensor-Module-For-MWC-Arduino-/321180164174?pt=LH_DefaultDomain_0&hash=item4ac7d4604e
     
    Props:
    http://www.ebay.com/itm/Buying-4pc-4025-4-x2-5-pitch-EP-Electric-Prop-Black-/360796268980?pt=Radio_Control_Parts_Accessories&hash=item54012229b4
     
    Hobby King
     
    Motors:
    http://www.hobbyking.com/hobbyking/store/%5F%5F34099%5F%5FhexTronik%5F5gram%5FBrushless%5FOutrunner%5F2000kv%5FUSA%5FWarehouse%5F.html
     
    ESC:
    http://www.hobbyking.com/hobbyking/store/%5F%5F30698%5F%5FTURNIGY%5FPlush%5F6A%5F8bec%5F6g%5FSpeed%5FController%5FUS%5FWarehouse%5F.html
     
    Battery:
    http://www.hobbyking.com/hobbyking/store/__18646__ZIPPY_Flightmax_800mAh_2S1P_20C_US_Warehouse_.html
     (Had the charger for this battery already)
     
    RX & TX:
    http://www.hobbyking.com/hobbyking/store/__9041__Hobby_King_2_4Ghz_6Ch_Tx_Rx_V2_Mode_1_.html
     
     
     
     
    The inspiration and foundation of our project was from another blogger, thanhTran, and below is a link to his completed project. We could not have gone as far as we did without him.
     
    http://www.rcgroups.com/forums/showthread.php?t=1335765
     
    Our plan was first to use thanhTran
    FinalProjectBlogpost.pdf
×
×
  • Create New...