Jump to content
43oh

oPossum

Members
  • Content Count

    925
  • Joined

  • Last visited

  • Days Won

    103

Reputation Activity

  1. Like
    oPossum reacted to Fred in Buying an oscilloscope, need some advice.   
    I know this is an old topic but thought it deserved an update. I'm happy with my DS1074Z although I've not had a chance to use it as much as I'd like. However, it seems there's a new "hobby level" version - the DS1054Z at a really good price. Same but 50MHz rather than 70. No idea if it can be hacked in the same way as the DS1074Z (alledgedly) can but if you're considering a low end scope it looks like a good option.
  2. Like
    oPossum got a reaction from rostlaur in The Terminal - 43oh OLED Booster Pack   
    MikroElektronica GLCD Font Creator (free)
     
    "GLCD Font Creator is the ultimate solution to create personalized fonts, symbols and icons for Graphic LCD (GLCD). It lets you create fonts for Liquid Crystal Displays (LCD) and Graphic LCD. It provides a very nice and intuitive user interface. GLCD Font Creator lets you create fonts and symbols from scratch, or by importing existing fonts on your system. It lets you modify and adjust them for your needs, apply effects to them, and finally export them as source code for use in your favorite language compiler."
  3. Like
    oPossum got a reaction from rampadc in Daylight Saving Time detection and adjustment   
    This code quickly determines if a date is within daylight savings time (DST). A companion function adjusts the date and time if necessary.
     
    There are many ways to determine if a date is within DST. This code begins by checking large time spans (months) and works down to shorter time spans (hours) as necessary. So for most of the year the decision is made very quickly. The worst cases occur on the days of the transition.
     
    BCD representation is used for compatibility with most hardware RTC chips. The day of week (T_RTC.dow) must be set properly for this code to work. Day of week is a value of 1 (Sunday) to 8 (Saturday).
     
     

    typedef struct { // RTC data structure uint8_t sec; // uint8_t min; // uint8_t hour; // uint8_t dow; // uint8_t day; // uint8_t month; // uint8_t year; // } T_RTC; // // Starting in 2007, most of the United States and Canada observe DST from the second Sunday in March to the first Sunday in November int rtc_is_dst(T_RTC const * const rtc) // --- Check if time & date are within DST { // if((rtc->month > 0x03) && (rtc->month < 0x11)) return 1; // After March and before November is DST if((rtc->month < 0x03) || (rtc->month > 0x11)) return 0; // Before March or after November is not DST if(rtc->month == 0x03) { // March if(rtc->day > 0x15) return 1; // After second week, is DST if(rtc->day < 0x08) return 0; // Before second week, is not DST const int d = ((rtc->day >> 4) * 10) + (rtc->day & 0x0F); // Integer day of month int s = d - rtc->dow + 1; // Current or previous Sunday as day of month if(s < 8) s += 7; // Make sure Sunday is in second week if(d < s) return 0; // Before Sunday, is not DST if(d > s) return 1; // After Sunday, is DST if((rtc->hour & 0x3F) < 0x02) return 0; // Before 2:00, is not DST return 1; // 2:00 or after, is DST } else { // rtc->month == 0x11 // November if(rtc->day > 0x07) return 0; // After first week, not DST const int d = ((rtc->day >> 4) * 10) + (rtc->day & 0x0F); // Integer day of month int s = d - rtc->dow + 1; // Current or previous Sunday as day of month if(s < 0) s += 7; // Make sure Sunday is in first week if(d < s) return 1; // Before Sunday, is DST if(d > s) return 0; // After Sunday, is not DST if((rtc->hour & 0x3F) < 0x02) return 1; // Before 2:00, is DST return 0; // 2:00 or after, is not DST } // } // // void rtc_adjust_dst(T_RTC * const rtc) // --- Correct RTC structure for DST if necessary { // static const uint8_t dm[19] = { 0, 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0, 0, 0, 0, 0, 0, 0x31, 0x30, 0x31 }; if(rtc_is_dst(rtc)) { // If DST ++rtc->hour; // Increment hour if((rtc->hour & 0x0F) > 9) rtc->hour += 6; // Adjust for BCD if(rtc->hour > 0x23) { // If next day rtc->hour = 0; // Set hour to 0 ++rtc->dow; // Increment day of week if(rtc->dow > 7) rtc->dow = 1; // Adjust for wrap around ++rtc->day; // Increment day of month if((rtc->day & 0x0F) > 9) rtc->day += 6; // Adjust for BCD if(rtc->day > dm[rtc->month]) { // Check if next month rtc->day = 0x01; // Wrap to first day of next month ++rtc->month; // Increment month if((rtc->month & 0x0F) > 9) rtc->month += 6; // Adjust for BCD } // } // } // } //
  4. Like
    oPossum reacted to petertux in MSP430 tracker   
    here's my latest project, a fully open-source msp430f5510-based gps/gprs tracker. it's a device that wakes up every few minutes and does the following:

     - tries to get a gps fix
     - connects to the gsm network, marks the tower cell ids it talks to
     - executes sms commands received - if any
     - starts a gprs connection and sends all the info it has collected via http to my server

    it does all this only based on interrupts (zero blocking functions are used - all the similar projects I've seen are riddled with delay()s).
    functions that fail due to network unavailability are retried a given number of times.

    the data received on the server is placed into a database and gps positions of the cell towers are obtained for future triangulation. this info can be used if there is no gps coverage due to obstacles.
     


    to give a little context, I felt the need of making my own tracker because I bought something like this an year ago and quickly became dissapointed by the dubious quality of the hardware design and software of the product.

    here is the first prototype - the magnet wire was used to debug the hardware flow control-enabled UART of the sim900.



    the first assembled module is ready to be used on my trip to Greece. instead of a small flat LiPo I ended up using 2 cells from a discarded laptop battery - there was no time to wire this to my motorbike. now after ~20 days it is still tracking.



    I am pretty happy with this first revision, but I'm working on the next one that will include a small serial fram chip. I decided to use that as a buffer because of the weird way the mobile phone company is counting the gprs traffic.

    for some more eye-candy, you can see my route from home to Ouranoupoli on a google-map overlay here:
    http://www.simplex.ro/files/trips/test.html
     
    waypoints are 10 minutes apart, the trip took 10 hours and about 800km.

    project home: https://github.com/rodan/tracy
     

     
  5. Like
    oPossum got a reaction from zborgerd in Daylight Saving Time detection and adjustment   
    This code quickly determines if a date is within daylight savings time (DST). A companion function adjusts the date and time if necessary.
     
    There are many ways to determine if a date is within DST. This code begins by checking large time spans (months) and works down to shorter time spans (hours) as necessary. So for most of the year the decision is made very quickly. The worst cases occur on the days of the transition.
     
    BCD representation is used for compatibility with most hardware RTC chips. The day of week (T_RTC.dow) must be set properly for this code to work. Day of week is a value of 1 (Sunday) to 8 (Saturday).
     
     

    typedef struct { // RTC data structure uint8_t sec; // uint8_t min; // uint8_t hour; // uint8_t dow; // uint8_t day; // uint8_t month; // uint8_t year; // } T_RTC; // // Starting in 2007, most of the United States and Canada observe DST from the second Sunday in March to the first Sunday in November int rtc_is_dst(T_RTC const * const rtc) // --- Check if time & date are within DST { // if((rtc->month > 0x03) && (rtc->month < 0x11)) return 1; // After March and before November is DST if((rtc->month < 0x03) || (rtc->month > 0x11)) return 0; // Before March or after November is not DST if(rtc->month == 0x03) { // March if(rtc->day > 0x15) return 1; // After second week, is DST if(rtc->day < 0x08) return 0; // Before second week, is not DST const int d = ((rtc->day >> 4) * 10) + (rtc->day & 0x0F); // Integer day of month int s = d - rtc->dow + 1; // Current or previous Sunday as day of month if(s < 8) s += 7; // Make sure Sunday is in second week if(d < s) return 0; // Before Sunday, is not DST if(d > s) return 1; // After Sunday, is DST if((rtc->hour & 0x3F) < 0x02) return 0; // Before 2:00, is not DST return 1; // 2:00 or after, is DST } else { // rtc->month == 0x11 // November if(rtc->day > 0x07) return 0; // After first week, not DST const int d = ((rtc->day >> 4) * 10) + (rtc->day & 0x0F); // Integer day of month int s = d - rtc->dow + 1; // Current or previous Sunday as day of month if(s < 0) s += 7; // Make sure Sunday is in first week if(d < s) return 1; // Before Sunday, is DST if(d > s) return 0; // After Sunday, is not DST if((rtc->hour & 0x3F) < 0x02) return 1; // Before 2:00, is DST return 0; // 2:00 or after, is not DST } // } // // void rtc_adjust_dst(T_RTC * const rtc) // --- Correct RTC structure for DST if necessary { // static const uint8_t dm[19] = { 0, 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0, 0, 0, 0, 0, 0, 0x31, 0x30, 0x31 }; if(rtc_is_dst(rtc)) { // If DST ++rtc->hour; // Increment hour if((rtc->hour & 0x0F) > 9) rtc->hour += 6; // Adjust for BCD if(rtc->hour > 0x23) { // If next day rtc->hour = 0; // Set hour to 0 ++rtc->dow; // Increment day of week if(rtc->dow > 7) rtc->dow = 1; // Adjust for wrap around ++rtc->day; // Increment day of month if((rtc->day & 0x0F) > 9) rtc->day += 6; // Adjust for BCD if(rtc->day > dm[rtc->month]) { // Check if next month rtc->day = 0x01; // Wrap to first day of next month ++rtc->month; // Increment month if((rtc->month & 0x0F) > 9) rtc->month += 6; // Adjust for BCD } // } // } // } //
  6. Like
    oPossum got a reaction from bluehash in Daylight Saving Time detection and adjustment   
    This code quickly determines if a date is within daylight savings time (DST). A companion function adjusts the date and time if necessary.
     
    There are many ways to determine if a date is within DST. This code begins by checking large time spans (months) and works down to shorter time spans (hours) as necessary. So for most of the year the decision is made very quickly. The worst cases occur on the days of the transition.
     
    BCD representation is used for compatibility with most hardware RTC chips. The day of week (T_RTC.dow) must be set properly for this code to work. Day of week is a value of 1 (Sunday) to 8 (Saturday).
     
     

    typedef struct { // RTC data structure uint8_t sec; // uint8_t min; // uint8_t hour; // uint8_t dow; // uint8_t day; // uint8_t month; // uint8_t year; // } T_RTC; // // Starting in 2007, most of the United States and Canada observe DST from the second Sunday in March to the first Sunday in November int rtc_is_dst(T_RTC const * const rtc) // --- Check if time & date are within DST { // if((rtc->month > 0x03) && (rtc->month < 0x11)) return 1; // After March and before November is DST if((rtc->month < 0x03) || (rtc->month > 0x11)) return 0; // Before March or after November is not DST if(rtc->month == 0x03) { // March if(rtc->day > 0x15) return 1; // After second week, is DST if(rtc->day < 0x08) return 0; // Before second week, is not DST const int d = ((rtc->day >> 4) * 10) + (rtc->day & 0x0F); // Integer day of month int s = d - rtc->dow + 1; // Current or previous Sunday as day of month if(s < 8) s += 7; // Make sure Sunday is in second week if(d < s) return 0; // Before Sunday, is not DST if(d > s) return 1; // After Sunday, is DST if((rtc->hour & 0x3F) < 0x02) return 0; // Before 2:00, is not DST return 1; // 2:00 or after, is DST } else { // rtc->month == 0x11 // November if(rtc->day > 0x07) return 0; // After first week, not DST const int d = ((rtc->day >> 4) * 10) + (rtc->day & 0x0F); // Integer day of month int s = d - rtc->dow + 1; // Current or previous Sunday as day of month if(s < 0) s += 7; // Make sure Sunday is in first week if(d < s) return 1; // Before Sunday, is DST if(d > s) return 0; // After Sunday, is not DST if((rtc->hour & 0x3F) < 0x02) return 1; // Before 2:00, is DST return 0; // 2:00 or after, is not DST } // } // // void rtc_adjust_dst(T_RTC * const rtc) // --- Correct RTC structure for DST if necessary { // static const uint8_t dm[19] = { 0, 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0, 0, 0, 0, 0, 0, 0x31, 0x30, 0x31 }; if(rtc_is_dst(rtc)) { // If DST ++rtc->hour; // Increment hour if((rtc->hour & 0x0F) > 9) rtc->hour += 6; // Adjust for BCD if(rtc->hour > 0x23) { // If next day rtc->hour = 0; // Set hour to 0 ++rtc->dow; // Increment day of week if(rtc->dow > 7) rtc->dow = 1; // Adjust for wrap around ++rtc->day; // Increment day of month if((rtc->day & 0x0F) > 9) rtc->day += 6; // Adjust for BCD if(rtc->day > dm[rtc->month]) { // Check if next month rtc->day = 0x01; // Wrap to first day of next month ++rtc->month; // Increment month if((rtc->month & 0x0F) > 9) rtc->month += 6; // Adjust for BCD } // } // } // } //
  7. Like
    oPossum reacted to Druzyek in Propeller open-sources P8X32A processor   
    I think most people misunderstand the philosophy behind the propeller. They left out all of the timers and interrupts on purpose and you have 8 cores so you can do the same as you could with 1 core and loads of peripherals. The difference is you now have room for 7 custom peripherals and 1 main core.
     
    I'm not sure why you would want 8 cores running simultaneously anyway. Efficiently using even 2 cores for 1 task is a non-trivial problem. Other microcontrollers handle multiple tasks with 1 core. Why not give each task its own core and eliminate other problems like interrupt latency while you're at it?
  8. Like
    oPossum got a reaction from altineller in State of I2C in MSP430 based devices. (MSP430F5529)   
    2.2k is a reasonable value for 3.3V IIC. Both SDA and SCL require resistors because they are both open drain (pulled low only). The SCL line is open drain to allow a slave to do clock stretching - a rarely used feature.
  9. Like
    oPossum got a reaction from abecedarian in State of I2C in MSP430 based devices. (MSP430F5529)   
    2.2k is a reasonable value for 3.3V IIC. Both SDA and SCL require resistors because they are both open drain (pulled low only). The SCL line is open drain to allow a slave to do clock stretching - a rarely used feature.
  10. Like
    oPossum got a reaction from abecedarian in How fast does this execute?   
    Those old 8 bit ECUs have support chips that help with all the timing critical stuff. With a G2553 you have a faster CPU, but only wo very basic timers. Each can only do two full featured compare outputs, so your need for three outputs is just beyond what it can easily do. The F5529 has a timer A with five outputs, and a timer B with 7 outputs, so it is much better able to do what you need.
  11. Like
    oPossum got a reaction from tripwire in Propeller open-sources P8X32A processor   
    No, not due to sales. Sales are fine at Parallax. They have been releasing a FPGA bitstream for the Propeller 2 that has been under development. The community really like being able to test a next gen chip before it became available. The release of a VHDL and bitstream for a Propeller 1 workalike will in no way harm sales of the Propeller chip. The FPGA is much more expensive then a propeller chip, and it would not be cost effective for a competitor to have an ASIC made. It is simply something they are doing for a few in the community that can hack away at the VHDL and do cool stuff.
  12. Like
    oPossum got a reaction from OppaErich in Propeller open-sources P8X32A processor   
    No, not due to sales. Sales are fine at Parallax. They have been releasing a FPGA bitstream for the Propeller 2 that has been under development. The community really like being able to test a next gen chip before it became available. The release of a VHDL and bitstream for a Propeller 1 workalike will in no way harm sales of the Propeller chip. The FPGA is much more expensive then a propeller chip, and it would not be cost effective for a competitor to have an ASIC made. It is simply something they are doing for a few in the community that can hack away at the VHDL and do cool stuff.
  13. Like
    oPossum got a reaction from bluehash in Propeller open-sources P8X32A processor   
    No, not due to sales. Sales are fine at Parallax. They have been releasing a FPGA bitstream for the Propeller 2 that has been under development. The community really like being able to test a next gen chip before it became available. The release of a VHDL and bitstream for a Propeller 1 workalike will in no way harm sales of the Propeller chip. The FPGA is much more expensive then a propeller chip, and it would not be cost effective for a competitor to have an ASIC made. It is simply something they are doing for a few in the community that can hack away at the VHDL and do cool stuff.
  14. Like
    oPossum got a reaction from roadrunner84 in Simplest Standalone MSP430G2553 with USB-Serial?   
    The FTDI is capable of jitter free operation at 3,000,000 / N bps. It can use fractional division for operation at more bit rates, but that causes some jitter, so I don't recommend it. It has no special knowledge of 'standard' bit rates like some other chips - it is a simple divider.
     
    So the highest reliable bit rates for the FTDI chips are 1.5M, 1M, 750k, 600k, 500k, etc...
  15. Like
    oPossum got a reaction from RobB in Simplest Standalone MSP430G2553 with USB-Serial?   
    Get a FDTI board. Just do it. You will find many uses for it and soon have several.
     
    6 channel MSP430 logic analyzer with 256k sample memory: http://forum.43oh.com/topic/2480-6-channel-logic-analyzer/
  16. Like
    oPossum got a reaction from StefanWxx in strtok_r Problem   
    char *p = text; char *q; char *str; while ((str = strtok_r(p, ",", &q)) != NULL) // delimiter is comma { p = NULL; Serial.println(str); delay(500); }
  17. Like
    oPossum got a reaction from mpigsley in While(1) not Executing with Timer Interrupt   
    TA0CCR0 = 22; // Count limit Bump that to 100 or higher 
    You are very close to ISR overhead at 23 cycles.
  18. Like
    oPossum got a reaction from ipn18 in print sensor reading on the LCD sharp memory BoosterPack ?   
    This can be made a bit more efficient by using the C standard library function div(). It will provide the quotient (/) and remainder (%) with a single math operation rather than two.
     
    For example, for two digits...

    div_t d = div(n, 10); text_buffer[0] = '0' + d.quot; // tens text_buffer[1] = '0' + d.rem; // ones For three digits...
    div_t d = div(n, 100); text_buffer[0] = '0' + d.quot; // hundreds d = div(d.rem, 10); text_buffer[1] = '0' + d.quot; // tens text_buffer[2] = '0' + d.rem; // ones For four digits...
    div_t d = div(n, 1000); text_buffer[0] = '0' + d.quot; // thousands d = div(d.rem, 100); text_buffer[1] = '0' + d.quot; // hundreds d = div(d,rem, 10); text_buffer[2] = '0' + d.quot; // tens text_buffer[3] = '0' + d.rem; // ones etc...
  19. Like
    oPossum got a reaction from spirilis in print sensor reading on the LCD sharp memory BoosterPack ?   
    This can be made a bit more efficient by using the C standard library function div(). It will provide the quotient (/) and remainder (%) with a single math operation rather than two.
     
    For example, for two digits...

    div_t d = div(n, 10); text_buffer[0] = '0' + d.quot; // tens text_buffer[1] = '0' + d.rem; // ones For three digits...
    div_t d = div(n, 100); text_buffer[0] = '0' + d.quot; // hundreds d = div(d.rem, 10); text_buffer[1] = '0' + d.quot; // tens text_buffer[2] = '0' + d.rem; // ones For four digits...
    div_t d = div(n, 1000); text_buffer[0] = '0' + d.quot; // thousands d = div(d.rem, 100); text_buffer[1] = '0' + d.quot; // hundreds d = div(d,rem, 10); text_buffer[2] = '0' + d.quot; // tens text_buffer[3] = '0' + d.rem; // ones etc...
  20. Like
    oPossum got a reaction from yosh in print sensor reading on the LCD sharp memory BoosterPack ?   
    This can be made a bit more efficient by using the C standard library function div(). It will provide the quotient (/) and remainder (%) with a single math operation rather than two.
     
    For example, for two digits...

    div_t d = div(n, 10); text_buffer[0] = '0' + d.quot; // tens text_buffer[1] = '0' + d.rem; // ones For three digits...
    div_t d = div(n, 100); text_buffer[0] = '0' + d.quot; // hundreds d = div(d.rem, 10); text_buffer[1] = '0' + d.quot; // tens text_buffer[2] = '0' + d.rem; // ones For four digits...
    div_t d = div(n, 1000); text_buffer[0] = '0' + d.quot; // thousands d = div(d.rem, 100); text_buffer[1] = '0' + d.quot; // hundreds d = div(d,rem, 10); text_buffer[2] = '0' + d.quot; // tens text_buffer[3] = '0' + d.rem; // ones etc...
  21. Like
    oPossum got a reaction from eifiu in help with code test error "printf" to msp430   
    You need to have #include <msp430.h> at the top of your source file to have access to the MSP430 registers.
  22. Like
    oPossum reacted to username in DAC GUI V2   
    Hey all,
     
    Round 2: This extends the peripherals of the MSP430 to a UART based ascii AT command set. For example, send "AT+GET_ADC" over the USB->Serial bridge to get all the ADC values returned. Since I released my first GUI there have been a couple others like it. You will find that this version's strength is that the underlying C driver set is my personal driver set which is quite powerful XD . I then wrote a C# GUI as a wrapper around this command set.
     
    Features Implemented: Digital IO, Analog I, PWM, SPI

     
    PWM Example:

     
    Steps to use:
    1. Download code & .exe file here: https://github.com/NateZimmer/ICBM
    2. Import C code into CCSV5.1 (haven't tested with other versions) and flash to launchpad.
    3. Ensure UART jumpers on the MSP430 Launchpad are set to Hardware based UART on a msp430g2553 launchpad Rev 1.5
    4. Run GUI and connect to launchpad.
    5. Enjoy!
     
    Skip to 10:35 for setup instructions:
     
     


     
    Todo:
    Implement DCO Calibration for better CLK accuracy
    Implement I2C
    Implement Graphing/Logging
    Implement more flexible spi chip select features
     
    Please let me know if this does not work for you
  23. Like
    oPossum got a reaction from abecedarian in "spikes" in the ultrasonic reading   
    Using a 74HC238 to limit transmission to only one module may be helpful. With all of them sending all of the time there may be problems with echos from the transmissions of other modules.
  24. Like
    oPossum reacted to HylianSavior in Robotics Boosterpack   
    Board all soldered up and working! Hopefully we'll have some demo videos out soon.
     


  25. Like
    oPossum got a reaction from stirlingboy in USCI UART bit rate setting   
    The MSP430x2xx Family User's Guide has several forumulas and tables for UART bit rate calculation. Makes it look more complicated than it is. Here is simple code to setup the bit rate divisor and modulator (for oversampling mode).
     
    First you need to know the SMCLK frequency and the desired bit rate.

    const unsigned long smclk_freq = 16000000; // SMCLK frequency in hertz const unsigned long bps = 19200; // Async serial bit rate Then a 20 bit divisor value can be calculated.
    const unsigned long brd = (smclk_freq + (bps >> 1)) / bps; // Bit rate divisor Shift and mask to setup the registers.
    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 That's it! 
    A function for UART setup at a specified bit rate...

    const unsigned long smclk_freq = 16000000; // SMCLK frequency in hertz void setup_UART(const unsigned long bps) // Async serial bit rate { 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 }
×
×
  • Create New...