Jump to content

Search the Community

Showing results for tags 'strings'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 1 result

  1. I'm using Energia with a Launchpad (LM4F120XL), and I've found some strange behavior when using a timer interrupt. When the interrupt setup code is compiled in, functions that do string processing (atoi, strtoul, strtok, etc.) do not return the expected value. In the code below, atoi() will return 0 when given the input "12". Note that the timer interrupt hasn't even been set up at the point where atoi() is called. In particular, it's the call to IntRegister() that causes the problem. The same code will work as expected if IntRegister() is commented out. Also note that everything works fine if an infinite loop is placed immediately before the initTimer() call -- in that case, I'm guessing the compiler is optimizing out everything in initTimer() because it's unreachable. strcmp() was also misbehaving (i.e. returning nonzero values for identical strings), but when I moved the const char* comparison string from global scope to function-level scope, the comparison began working as expected. Anyone have any ideas about this? It seems like it might have something to do with the arrangement of symbols in memory. --Colin #include "inc/hw_ints.h" #include "driverlib/sysctl.h" #include "driverlib/interrupt.h" #include "driverlib/timer.h" void timer0_handler(void) { TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); } void initTimer(unsigned Hz) { SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE, TIMER_CFG_32_BIT_PER); unsigned long ulPeriod = (SysCtlClockGet() / Hz) / 2; TimerLoadSet(TIMER0_BASE, TIMER_A, ulPeriod - 1); IntEnable(INT_TIMER0A); IntRegister(INT_TIMER0A, timer0_handler); TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); IntMasterEnable(); TimerEnable(TIMER0_BASE, TIMER_A); } void setup() { IntMasterDisable(); Serial.begin(9600); } void loop() { const char *dbuf = "12"; Serial.println(atoi(dbuf)); initTimer(3); while (1); }
×
×
  • Create New...