Hi crew:

I was working with some more interesting computing and a PIC16F716 ( mid range device)

so i enter this dummy code to create a sensor value fair easy but..lets see:

int msb,lsb; //obvious use

signed int16 word16; //you can bet what will happen here

float fword; //complicating the things

char result[5]; //yup thats the goal

void main()

{

//since i have no attached sensor here lets put some dummy data

msb=0xff; //in theory captured from the sensing device

lsb=0x1a; //same

word16=make16(msb,lsb); //now i have the whole thing joined

if (msb> 128) // if the MSBit of the MSByte is 1 then we have a negative number

{

word16=~word16 +1 ; // I make a two's complement of the number to get the number i need same as word16=word16-0x10000

}

//now the part that dont work

fword=word16 * 0.0625; //this simple operation would get rid of the entire problem...but something fails here

//now put this into the string

sprintf(result,"\f%5.1f",fword);

}

This lil code sounds easy, i get the -230 that should have in word16

but the time i do that simple multiply than i get a real weird value (-4.91112136e-032)

so the whole nice code goes ruined...the espected result is -14.375 (but i need to be displayed just -14.3 or -14.4, hence the 5.1 format)

surely I'm doing something real bad, but i can't catch the issue here.

Some input will be more than appreciated, for the interest and knowledge of all

Cheers