Hi - check that the stack isn't overflowing, this would cause all kinds=20 of crazy problems. How much stack space sscanf() needs could vary=20 widely depending on what you're trying to do. Some implementations of=20 sscanf() (like the TI code composer studio for ARM Cortex M3) use more=20 than 1K doing not much at all. How to know if the stack overflows? Someone else will have to help, I=20 don't know the dsPIC nor the C30 compiler. There are techniques that=20 fill the stack with a 'sentinel value' (say 0x55) early in main() and=20 then in the main application loop verify that the last available byte in=20 the RAM for the stack is 0x55. If it isn't, you used up all the stack=20 and very likely have overflowed. There may be a way to tell the C30 compiler how much stack to reserve.=20 Try making it really big to see if it magically fixes sscanf(). Just my 2c. J Bob Blick wrote: > Welcome to the Piclist. > It's a requirement to have a topic tag in the subject line, you must do > it, it is not automatically added! > Here is a reference: > http://mailman.mit.edu/mailman/listinfo/piclist > > I have taken the liberty of adding the [PIC] tag to your post. > > Best regards, Bob > > On Fri, Aug 9, 2013, at 06:14 PM, Mascalzone Latino wrote: >> I'm using a *Microchip C30 compiler* on *dsPIC33F family* and struggling >> A >> LOT with *sscanf() function*. Please please please help me because my >> project is getting stuck for this little detail. I really hope that >> someone >> can help me, I haven't found anything on internet and I spent the last 2 >> days on this issue. Thanks a lot in advance*THE TASK*I have to read >> different types of numbers from a string (unsigned int, float, char and >> unsigned char).*THE ISSUES*I have problems reading numeric char and >> unsigned >> char (i.e. 8 bit numbers, not ASCII characters), but not the other ones. >> With problem I mean that sscanf() fails (crashes) during its execution >> without returning any numeric value. In particular the problems come whe= n >> I >> try to read more than one char (or unsigned char) in a row. As a char >> conversion specifier I use %hhd, but I tried - at least I think - with >> all >> the possible combinations. For unsigned char I used %hhu.In order to >> understand better please look at this examples with just float and char. >> Float are read correctly, char just in case A) with one char >> parameter.*A) >> JUST ONE CHAR HAS TO BE READ: it works correctly*// 99 init values just >> for >> debugging resonschar string[] =3D "test1 12,1.525,2.789";char theChar1 = =3D >> 99;float theFloat1;float theFloat2;int retVal =3D 99;retVal =3D >> sscanf(&string[6],"%f,%f,%hhd",&theFloat1, &theFloat2, &theChar1);*B) TW= O >> CHARS HAVE TO BE READ: it doesn't work, sscanf() does not complete its >> execution and doesn't provide a return value*// 99 init values just for >> debugging resonschar string[] =3D "test1 12,1.525,2.789";char theChar1 = =3D >> 99; >> char theChar2 =3D 99;float theFloat1;float theFloat2;int retVal =3D 99;r= etVal >> =3D >> sscanf(&string[6],"%f,%f,%hhd,%hhd",&theFloat1, &theFloat2, &theChar1, >> &theChar2);*C) THREE CHARS HAVE TO BE READ: it doesn't work, sscanf() >> does >> not complete its execution and doesn't provide a return value*// 99 init >> values just for debugging resonschar string[] =3D "test1 >> 12,1.525,2.789";char >> theChar1 =3D 99; char theChar2 =3D 99;float theFloat1;float theFloat2;in= t >> retVal >> =3D 99;retVal =3D sscanf(&string[6],"%f,%f,%hhd,%hhd,%hhd",&theFloat1, >> &theFloat2, &theChar1, &theChar2, &theChar3);*THANKS SO MUCH FOR YOUR >> HELP!!!* > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .