We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
snprintf() does not appear to work with floating point format within a task. Appears to work normally from main().
Please advise why, and what other functions may be affected similary?
I modified a 'blinky' project and observed the fault under simulation, single step, watch memory 'buffer'.
Seems to work ok if called from main.
---------------------------------------------- char buffer[100];
void test1(void) { float f;
f = 3.14159;
snprintf(buffer,100-1,"%f",f);
/* HELP!!!!! contents of buffer are now '0.000000' , should be '3.141590' */ } /*---------------------------------------------------------------------------- * Task 1 'phaseA': Phase A output *---------------------------------------------------------------------------*/ void phaseA (void) __task { for (;;) { test1(); os_evt_wait_and (0x0001, 0xffff); /* wait for an event flag 0x0001 */ IOSET = LED_A; signal_func (t_phaseB); /* call common signal function */ IOCLR = LED_A;
} } -------------------------------------------------------------------