Thibault Bonnevie

sscanf and sprintf on mc9s12dj128b

Discussion created by Thibault Bonnevie on Jun 27, 2006
Latest reply on Sep 8, 2006 by kenneth wikeroey
Hello,

I want to extract some informations from a string.
This string has not always the same lengh, but all values are separated by a ",".
The string on wich I work is an NMEA GPS string for people who now their structure.

So what I want to do is a sscanf. The fonction work properly on a PC with visual studio 2005. But the same code don't want to work on my mc9s12. The compilator doesn(t return any error but no values has extracted.

I'm using sscanf like below :
nbValuesReturned = sscanf(dataReceived,"$GPRMC,%2d%2d%2d.00,%c,%2d%f,N,%2d%f,E,%*f,%f,%2d%2d%2d",time.hour,time.minute,time.seconde,validity.positionOk,latitudeDegree,position.latitude,longitudeDegree,position.longitude,position.course,time.day,time.month,time.year);

I know the line is very long but I've test on shorter strings but it is the same thing.

Is someone has an idea ? Maybe sscanf can't work on mc9s12 ?

I have the same problem with sprintf wich is the opposite of sscanf.

I'm sorry for my english. If someone has an idea it will be really usefull for me.

Thanks,

Bobby

Outcomes